Documentation
¶
Overview ¶
Package imapc is the IMAP4rev1 client the reply-by-mail poller needs (#295): LOGIN, SELECT or EXAMINE, UID SEARCH UNSEEN, UID FETCH BODY.PEEK[], UID STORE +FLAGS (\Seen), LOGOUT. Nothing else. The connection is TLS from the first byte or upgraded with STARTTLS before LOGIN; there is no plaintext mode.
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Close() error
- func (c *Client) Examine(mailbox string) (int, error)
- func (c *Client) Fetch(uid uint32) ([]byte, error)
- func (c *Client) Login(user, pass string) error
- func (c *Client) MarkSeen(uid uint32) error
- func (c *Client) Select(mailbox string) (int, error)
- func (c *Client) SetDeadline(t time.Time) error
- func (c *Client) Unseen() ([]uint32, error)
- type RefusedError
Constants ¶
const MaxMessage = 10 << 20
MaxMessage is the largest message Fetch returns; a larger one is refused by its RFC822.SIZE before its body is fetched (ErrTooLarge).
const MaxUnseen = 10000
MaxUnseen is the most UIDs Unseen returns; the rest wait for the next poll.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is one authenticated IMAP session.
func Dial ¶
Dial connects to addr (host:port) and reads the greeting. With starttls it upgrades the connection before returning; otherwise TLS runs from the first byte.
func New ¶
New wraps a connection that is already past its TLS handshake, or a test's pipe. The greeting has not been read.
func Open ¶
Open connects to the configured mailbox, logs in with the password file's password, and opens the mailbox: read-only (EXAMINE) or for setting flags (SELECT). It returns the number of messages in it.
func (*Client) Fetch ¶
Fetch returns the whole message without setting \Seen. A message over MaxMessage is refused by its size first. A server answering BODY[] with NIL or "" returns an empty message.
func (*Client) Login ¶
Login authenticates. The password goes as a quoted string, so it may not hold a line break or a byte outside printable ASCII.
func (*Client) Select ¶
Select opens mailbox for reading and writing flags; Examine opens it read-only. Both return the number of messages in it.
func (*Client) SetDeadline ¶
SetDeadline bounds the session's remaining I/O.
type RefusedError ¶
type RefusedError struct{ Text string }
RefusedError is the server answering a command NO or BAD, or answering a FETCH with no message: a refusal of that command, with the session still usable.
func (*RefusedError) Error ¶
func (e *RefusedError) Error() string
Source Files
¶
- imapc.go
- open.go