Documentation
¶
Overview ¶
Package mailclient implements the small IMAP client used by the perch CLI. It deliberately exposes only the operations needed to list, search, and fetch mail so that the command-line surface stays predictable.
Index ¶
- func ParseQuery(query string) (*imap.SearchCriteria, error)
- func ParseUIDSet(value string) (imap.UIDSet, error)
- type Client
- func (c *Client) Close() error
- func (c *Client) FetchRaw(uid imap.UID, markSeen bool) (Message, error)
- func (c *Client) Mailboxes(subscribedOnly bool) ([]Mailbox, error)
- func (c *Client) SearchUIDs(criteria *imap.SearchCriteria) ([]imap.UID, error)
- func (c *Client) Select(mailbox string, readOnly bool) (*imap.SelectData, error)
- func (c *Client) Summaries(uids []imap.UID) ([]Message, error)
- type Mailbox
- type Message
- type Options
- type TLSMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseQuery ¶
func ParseQuery(query string) (*imap.SearchCriteria, error)
ParseQuery converts a compact, shell-friendly search expression into IMAP search criteria. Bare words are matched against the message text. Supported keys are from, to, cc, bcc, subject, body, text, header:Name=Value, since, before, on, sent-since, sent-before, sent-on, seen, unseen, answered, unanswered, flagged, unflagged, deleted, undeleted, draft, undraft, larger, smaller, uid, flag/keyword, and unflag/unkeyword.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the go-imap client with the operations perch exposes.
func (*Client) FetchRaw ¶
FetchRaw fetches one complete message. When markSeen is false, BODY.PEEK is used so the server does not change the \Seen flag.
func (*Client) Mailboxes ¶
Mailboxes lists mailboxes. When subscribedOnly is set, only subscribed mailboxes are returned.
func (*Client) SearchUIDs ¶
SearchUIDs runs a UID SEARCH and returns the matching UIDs in server order.
type Mailbox ¶
type Mailbox struct {
Name string
Delimiter string
Attributes []string
SpecialUse []string
Subscribed bool
}
Mailbox is one entry returned by LIST.
type Message ¶
type Message struct {
UID imap.UID
SeqNum uint32
Flags []string
Size int64
InternalDate time.Time
Envelope *imap.Envelope
Raw []byte
}
Message contains the metadata and, when requested, the raw message.
type Options ¶
type Options struct {
Addr string
TLSMode TLSMode
TLSConfig *tls.Config
Username string
Password string
Timeout time.Duration
}
Options configures Dial.