Documentation
¶
Index ¶
- Constants
- type Auth
- type Client
- func (c *Client) Auth(username, password string) (err error)
- func (c *Client) Cmd(format string, args ...interface{}) (string, error)
- func (c *Client) Dele(msg int) (err error)
- func (c *Client) List(msg int) (size int, err error)
- func (c *Client) ListAll() (msgs []int, sizes []int, err error)
- func (c *Client) Noop() (err error)
- func (c *Client) Pass(password string) (err error)
- func (c *Client) Quit() error
- func (c *Client) ReadLines() (lines []string, err error)
- func (c *Client) Retr(msg int) (text string, err error)
- func (c *Client) Rset() (err error)
- func (c *Client) Stat() (count, size int, err error)
- func (c *Client) User(username string) (err error)
- type Conn
- type Maildrop
- type MessageHandler
- type Server
- func (s *Server) Address() string
- func (s *Server) Close()
- func (s *Server) GetAddressArg(argName string, args string) (*mail.Address, error)
- func (s *Server) HandlePOP3(conn *Conn) error
- func (s *Server) ListenAndServe(addr string) error
- func (s *Server) SetHelp(message string) error
- func (s *Server) UseTLS(cert, key string) error
Constants ¶
const ( AUTHORIZATION = iota TRANSACTION UPDATE )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
The POP3 client.
func Dial ¶
Dial creates an unsecured connection to the POP3 server at the given address and returns the corresponding Client.
func DialTLS ¶
DialTLS creates a TLS-secured connection to the POP3 server at the given address and returns the corresponding Client.
func (*Client) Auth ¶
Auth sends the given username and password to the server, calling the User and Pass methods as appropriate.
func (*Client) Cmd ¶
Convenience function to synchronously run an arbitrary command and wait for output. The terminating CRLF must be included in the format string.
Output sent after the first line must be retrieved via readLines.
func (*Client) List ¶
List returns the size of the given message, if it exists. If the message does not exist, or another error is encountered, the returned size will be 0.
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). Generally, there is no reason not to use the Auth convenience method.
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.
type Conn ¶
type Conn struct { net.Conn IsTLS bool Errors []error MaxSize int Maildrop Maildrop // transaction int State int // contains filtered or unexported fields }
func (*Conn) ReadPOP ¶
ReadSMTP pulls a single POP3 command line (ending in a carriage return + newline (aka CRLF))
func (*Conn) ReadUntil ¶
rawRead performs the actual read from the connection, reading each line up to the first occurrence of suffix
type MessageHandler ¶
MessageHandler functions handle application of business logic to the inbound message
type Server ¶
type Server struct { Name string TLSConfig *tls.Config ServerName string // MaxSize of incoming message objects, zero for no cap otherwise // larger messages are thrown away MaxSize int // MaxConn limits the number of concurrent connections being handled MaxConn int // MaxCommands is the maximum number of commands a server will accept // from a single client before terminating the session MaxCommands int // RateLimiter gets called before proceeding through to message handling RateLimiter func(*Conn) bool // Handler is the handoff function for messages Handler MessageHandler // Maildrop is a dropping point for a mail message Maildrop Maildrop // Disabled features Disabled map[string]bool // help message to display in response to a HELP request Help string // contains filtered or unexported fields }
func (*Server) GetAddressArg ¶
func (*Server) HandlePOP3 ¶
func (*Server) ListenAndServe ¶
ListenAndServe starts listening for SMTP commands at the supplied TCP address