Documentation
¶
Index ¶
- Constants
- func IsErr(s string) bool
- func IsOK(s string) bool
- type Client
- func (c *Client) Authorization(user, pass string) error
- func (c *Client) Dele(msg int) error
- func (c *Client) ListAll() (list []MessageList, err error)
- func (c *Client) Noop() error
- func (c *Client) Quit() error
- func (c *Client) Retr(msg int) (*enmime.Envelope, error)
- func (c *Client) Rset() error
- func (c *Client) Stat() (count, size int, err error)
- type Connection
- type MessageList
Constants ¶
const ( OK = "+OK" ERR = "-ERR" )
POP3 replies as extracted from rfc1939 section 9.
const ( CommandReset = "RSET" // CommandStat is a command to retrieve statistics about mailbox. CommandStat = "STAT" // CommandDelete is a command to delete message from POP3 server. CommandDelete = "DELE" // CommandList is a command to get list of messages from POP3 server. CommandList = "LIST" // CommandNoop is a ping-like command that tells POP3 to do nothing. // (i.e. send something line pong-response). CommandNoop = "NOOP" // CommandPassword is a command to send user password to POP3 server. CommandPassword = "PASS" // CommandQuit is a command to tell POP3 server that you are quitting. CommandQuit = "QUIT" // CommandRetrieve is a command to retrieve POP3 message from server. CommandRetrieve = "RETR" // CommandUser is a command to send user login to POP3 server. CommandUser = "USER" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for POP3.
func (*Client) Authorization ¶
Authorization logs into POP3 server with login and password.
func (*Client) Dele ¶
Dele will delete the given message from the maildrop. Changes will only take affect after the Quit command is issued.
func (*Client) ListAll ¶
func (c *Client) ListAll() (list []MessageList, err error)
ListAll returns a MessageList object which contains all messages in the maildrop.
type Connection ¶
type Connection struct { Reader *textproto.Reader Writer *textproto.Writer // contains filtered or unexported fields }
Client holds the net conn and read/write buffer objects.
func NewConnection ¶
func NewConnection(conn io.ReadWriteCloser) *Connection
NewConnection initializes a connection.
func (*Connection) Cmd ¶
func (c *Connection) Cmd(format string, args ...interface{}) (string, error)
Cmd sends the given command on the connection.
func (*Connection) ReadLine ¶
func (c *Connection) ReadLine() (string, error)
ReadLine reads a single line from the buffer.
func (*Connection) ReadLines ¶
func (c *Connection) ReadLines() (lines []string, err error)
ReadLines reads from the buffer until it hits the message end dot (".").
type MessageList ¶
type MessageList struct { // Non unique id reported by the server ID int // Size of the message Size int }
MessageList represents the metadata returned by the server for a message stored in the maildrop.