Documentation
¶
Overview ¶
Package pop3 provides simple POP3 client.
Index ¶
- Variables
- func ReceiveMail(addr, user, pass string, receiveFn ReceiveMailFunc) error
- type Client
- func (c *Client) Close() error
- func (c *Client) Dele(number int) error
- func (c *Client) List(number int) (int, uint64, error)
- func (c *Client) ListAll() ([]MessageInfo, error)
- func (c *Client) Noop() error
- func (c *Client) Pass(pass string) error
- func (c *Client) Quit() error
- func (c *Client) Retr(number int) (string, error)
- func (c *Client) Rset() error
- func (c *Client) Stat() (int, uint64, error)
- func (c *Client) Uidl(number int) (int, string, error)
- func (c *Client) UidlAll() ([]MessageInfo, error)
- func (c *Client) User(user string) error
- type Conn
- type MessageInfo
- type Reader
- type ReceiveMailFunc
- type ResponseError
- type Writer
Constants ¶
This section is empty.
Variables ¶
var (
EOF = errors.New("skip the all mail remaining")
)
Functions ¶
func ReceiveMail ¶
func ReceiveMail(addr, user, pass string, receiveFn ReceiveMailFunc) error
ReceiveMail connects to the server at addr, and authenticates with user and pass, and calling receiveFn for each mail.
Types ¶
type Client ¶
type Client struct { // Text is the pop3.Conn used by the Client. Text *Conn // contains filtered or unexported fields }
A Client represents a client connection to an POP server.
func Dial ¶
Dial returns a new Client connected to an POP server at addr. The addr must include a port number.
func (*Client) List ¶
List issues a LIST command to the server using the provided mail number and returns mail number and size.
func (*Client) ListAll ¶
func (c *Client) ListAll() ([]MessageInfo, error)
List issues a LIST command to the server and returns array of MessageInfo.
func (*Client) Retr ¶
Retr issues a RETR command to the server using the provided mail number and returns mail data.
func (*Client) Stat ¶
Stat issues a STAT command to the server and returns mail count and total size.
func (*Client) Uidl ¶
Uidl issues a UIDL command to the server using the provided mail number and returns mail number and unique id.
func (*Client) UidlAll ¶
func (c *Client) UidlAll() ([]MessageInfo, error)
Uidl issues a UIDL command to the server and returns array of MessageInfo.
type Conn ¶
A Conn represents a textual network protocol connection for POP3.
func NewConn ¶
func NewConn(conn io.ReadWriteCloser) *Conn
NewConn returns a new Conn using conn for I/O.
type MessageInfo ¶
MessageInfo has Number, Size, and Uid fields, and used as a return value of ListAll and UidlAll. When used as the return value of the method ListAll, MessageInfo contain only the Number and Size values. When used as the return value of the method UidlAll, MessageInfo contain only the Number and Uid values.
type Reader ¶
A Reader implements convenience methods for reading requests or responses from a text protocol network connection.
func (*Reader) ReadLine ¶
ReadLine reads a single line from r, eliding the final \n or \r\n from the returned string. This calls textproto.Reader.ReadLine simply.
func (*Reader) ReadLines ¶
ReadLines reads a multiline until the last line of the only period, and returns a each line at slice. it does not contain last period.
func (*Reader) ReadResponse ¶
ReadResponse reads a single line from r, and parses reponse. if the response is -ERR or has some other errors, it returns error.
func (*Reader) ReadToPeriod ¶
ReadToPeriod reads a multiline until the last line of the only period, and returns as a string. it does not contain last period.
type ReceiveMailFunc ¶
ReceiveMailFunc is the type of the function called for each mail. Its arguments are mail's number, uid, data, and mail receiving error. if this function returns false value, the mail will be deleted, if its returns EOF, skip the all mail of remaining. (after deleting mail, if necessary)
type ResponseError ¶
type ResponseError string
A ResponseError describes a protocol violation such as an invalid response or a hung-up connection.
func (ResponseError) Error ¶
func (r ResponseError) Error() string