Documentation ¶
Overview ¶
Package pop3 is a simple POP3 e-mail client library.
Index ¶
- type Client
- type Conn
- func (c *Conn) Auth(user, password string) error
- func (c *Conn) CAPA() (map[string]string, error)
- func (c *Conn) ChallengeCmd(cmd string, args ...interface{}) (buf *bytes.Buffer, isChallenge bool, err error)
- func (c *Conn) Cmd(cmd string, isMulti bool, args ...interface{}) (*bytes.Buffer, error)
- func (c *Conn) Dele(msgID ...int) error
- func (c *Conn) List(msgID int) ([]MessageID, error)
- func (c *Conn) Noop() error
- func (c *Conn) Pass(s string) error
- func (c *Conn) Quit() error
- func (c *Conn) ReadAll() (*bytes.Buffer, error)
- func (c *Conn) ReadOne() ([]byte, error)
- func (c *Conn) ReadOneWithChallenge() ([]byte, bool, error)
- func (c *Conn) Retr(msgID int) (*message.Entity, error)
- func (c *Conn) RetrRaw(msgID int) (*bytes.Buffer, error)
- func (c *Conn) Rset() error
- func (c *Conn) SASLAuth(a smtp.Auth) error
- func (c *Conn) Send(b string) error
- func (c *Conn) StartTLS(cfg *tls.Config) error
- func (c *Conn) Stat() (int, int, error)
- func (c *Conn) Top(msgID int, numLines int) (*message.Entity, error)
- func (c *Conn) Uidl(msgID int) ([]MessageID, error)
- func (c *Conn) User(s string) error
- type Dialer
- type MessageID
- type Opt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements a Client e-mail client.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a stateful connection with the POP3 server/
func (*Conn) ChallengeCmd ¶
func (*Conn) Cmd ¶
Cmd sends a command to the server. POP3 responses are either single line or multi-line. The first line always with -ERR in case of an error or +OK in case of a successful operation. OK+ is always followed by a response on the same line which is either the actual response data in case of single line responses, or a help message followed by multiple lines of actual response data in case of multiline responses. See https://www.shellhacks.com/retrieve-email-pop3-server-command-line/ for examples.
func (*Conn) Dele ¶
Dele deletes one or more messages. The server only executes the deletions after a successful Quit().
func (*Conn) List ¶
List returns a list of (message ID, message Size) pairs. If the optional msgID > 0, then only that particular message is listed. The message IDs are sequential, 1 to N.
func (*Conn) Noop ¶
Noop issues a do-nothing NOOP command to the server. This is useful for prolonging open connections.
func (*Conn) Quit ¶
Quit sends the QUIT command to server and gracefully closes the connection. Message deletions (DELE command) are only excuted by the server on a graceful quit and close.
func (*Conn) ReadAll ¶
ReadAll reads all lines from the connection until the POP3 multiline terminator "." is encountered and returns a bytes.Buffer of all the read lines.
func (*Conn) ReadOneWithChallenge ¶
ReadOne reads a single line response from the conn.
func (*Conn) Retr ¶
Retr downloads a message by the given msgID, parses it and returns it as a emersion/go-message.message.Entity object.
func (*Conn) RetrRaw ¶
RetrRaw downloads a message by the given msgID and returns the raw []byte of the entire message.
func (*Conn) SASLAuth ¶
SASLAuth authenticates a client using the provided authentication mechanism. A failed authentication closes the connection. Only servers that advertise the SASL capability can be authenticated using this method.
func (*Conn) Send ¶
Send sends a POP3 command to the server. The given comand is suffixed with "\r\n".
func (*Conn) Top ¶
Top retrieves a message by its ID with full headers and numLines lines of the body.