Documentation
¶
Index ¶
- type Client
- func (c *Client) Auth(user, pass string) error
- func (c *Client) Cmd(s string, isMulti bool, args ...any) (string, error)
- func (c *Client) Dele(ids ...int) error
- func (c *Client) List(id int) ([]MessageID, error)
- func (c *Client) Noop() error
- func (c *Client) Quit() error
- func (c *Client) Retr(id int) (string, error)
- func (c *Client) Rset() error
- func (c *Client) Stat() (count int, size int, err error)
- func (c *Client) Top(id int, numLines int) (string, error)
- func (c *Client) Uidl(id int) ([]MessageID, error)
- type MessageID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client represents a POP3 client connection. It embeds a textproto.Conn for low-level protocol communication.
func Dial ¶
Dial establishes a plain TCP connection to the POP3 server at the given address. The connection respects the provided context for timeout or cancellation.
func DialTLS ¶
DialTLS establishes a secure POP3-over-TLS connection to the given address. The server name is automatically derived from the address for certificate verification.
func NewClient ¶
NewClient initializes a POP3 client from an existing connection. It reads the server greeting line and validates that it starts with "+OK".
func (*Client) Auth ¶ added in v0.1.81
Auth authenticates the user using the USER/PASS commands. Returns an error if either step fails.
func (*Client) Cmd ¶
Cmd sends a POP3 command with optional arguments and reads the response. If isMulti is true, the response is treated as multi-line and read until a line containing only "." is encountered. All lines are concatenated and returned.
func (*Client) Dele ¶
Dele marks one or more messages for deletion. The deletions are finalized only after a successful Quit().
func (*Client) List ¶
List returns message IDs and sizes from the mailbox. If id > 0, only that specific message is listed (single-line response). If id == 0, all messages are listed (multi-line response).
func (*Client) Noop ¶
Noop sends a NOOP command to keep the connection alive. Useful for preventing idle timeouts.
func (*Client) Quit ¶
Quit sends the QUIT command and closes the connection gracefully. Deletions are committed only if QUIT succeeds.