Documentation
¶
Index ¶
- func Noop() option
- func UseTLS(config *tls.Config) option
- func UseTimeout(timeout time.Duration) option
- type Client
- func (client *Client) Auth(username, password string) (err error)
- func (client *Client) Dele(msg uint32) (err error)
- func (client *Client) List(msgSeqNum uint32) (size uint32, err error)
- func (client *Client) ListAll() (msgInfos []*MessageInfo, err error)
- func (client *Client) Noop() (err error)
- func (client *Client) Pass(password string) (err error)
- func (client *Client) Quit() (err error)
- func (client *Client) Retr(msg uint32) (text string, err error)
- func (client *Client) Rset() (err error)
- func (client *Client) Stat() (count, size uint32, err error)
- func (client *Client) UIDl(msgSeqNum uint32) (uid string, err error)
- func (client *Client) UIDlAll() (msgInfos []*MessageInfo, err error)
- func (client *Client) UseTimeouts(timeout time.Duration)
- func (client *Client) User(user string) (err error)
- type Connection
- func (c *Connection) Close() error
- func (c *Connection) Cmd(format string, args ...interface{}) (result string, err error)
- func (c *Connection) ReadMultiLines() (lines []string, err error)
- func (c *Connection) ReadResponse() (result string, err error)
- func (c *Connection) SendCMD(format string, args ...interface{})
- type MessageInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UseTLS ¶
UseTLS is a configuration function whose result is passed as a parameter in the Dial function. It configures the client to use TLS.
func UseTimeout ¶
UseTimeout is a configuration function whose result is passed as a parameter in the Dial function. It configures the client to use timeouts for each POP3 command.
Types ¶
type Client ¶
type Client struct { Text *Connection // contains filtered or unexported fields }
Client for POP3.
func Dial ¶
Dial connects to the given address and returns a client holding a tcp connection. To pass configuration to the Dial function use the methods UseTLS or UseTimeout. E.g. c, err = pop3.Dial(address, pop3.UseTLS(tlsConfig), pop3.UseTimeout(timeout))
func NewClient ¶
NewClient initializeds a client. To pass configuration to the NewClient function use the methods UseTLS or UseTimeout. E.g. c, err = pop3.Dial(address, pop3.UseTLS(tlsConfig), pop3.UseTimeout(timeout))
func (*Client) List ¶
List returns the size of the message referenced by the sequence number, if it exists. If the message does not exist, or another error is encountered, the returned size will be 0.
func (*Client) ListAll ¶
func (client *Client) ListAll() (msgInfos []*MessageInfo, err error)
ListAll returns a list of MessageInfo for all messages, containing their sequence number and size.
func (*Client) Noop ¶
Noop does nothing, but will prolong the end of the connection if the server has a timeout set.
func (*Client) Pass ¶
Pass sends the given password to the server. The password is sent unencrypted unless the connection is already secured by TLS (via DialTLS or some other mechanism).
func (*Client) Retr ¶
Retr downloads and returns the given message. The lines are separated by LF, whatever the server sent.
func (*Client) Stat ¶
Stat retrieves a drop listing for the current maildrop, consisting of the number of messages and the total size (in octets) of the maildrop. Information provided besides the number of messages and the size of the maildrop is ignored. In the event of an error, all returned numeric values will be 0.
func (*Client) UIDl ¶
UIDl retrieves the unique ID of the message referenced by the sequence number.
func (*Client) UIDlAll ¶
func (client *Client) UIDlAll() (msgInfos []*MessageInfo, err error)
UIDlAll retrieves the unique IDs and sequence number for all messages.
func (*Client) UseTimeouts ¶
UseTimeouts adds a timeout to the client. Timeouts are applied on every POP3 command.
type Connection ¶
type Connection struct { Reader *bufio.Reader Writer *bufio.Writer // contains filtered or unexported fields }
Connection stores a Reader and a Writer.
func NewConnection ¶
func NewConnection(conn io.ReadWriteCloser) *Connection
NewConnection initializes a connection.
func (*Connection) Cmd ¶
func (c *Connection) Cmd(format string, args ...interface{}) (result string, err error)
Cmd sends the given command on the connection.
func (*Connection) ReadMultiLines ¶
func (c *Connection) ReadMultiLines() (lines []string, err error)
ReadMultiLines reads a response with multiple lines.
func (*Connection) ReadResponse ¶
func (c *Connection) ReadResponse() (result string, err error)
ReadResponse reads the response from the server and parses it. It checks whether the response is OK and returns the result omitting the OK+ prefix.
func (*Connection) SendCMD ¶
func (c *Connection) SendCMD(format string, args ...interface{})
SendCMD writes the command on the writer and flushes the writer afterwards.
type MessageInfo ¶
type MessageInfo struct { Seq uint32 // Message sequence number Size uint32 // Message size in bytes UID string // Message UID }
MessageInfo represents the message attributes returned by a LIST command.