pop3

package
v0.1.74 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*textproto.Conn
}

func Dial

func Dial(ctx context.Context, addr string) (*Client, error)

func DialTLS

func DialTLS(ctx context.Context, addr string) (*Client, error)

func NewClient

func NewClient(conn net.Conn) (*Client, error)

func (*Client) Cmd

func (c *Client) Cmd(s string, isMulti bool, args ...any) (string, error)

func (*Client) Dele

func (c *Client) Dele(ids ...int) error

Dele deletes one or more messages. The server only executes the deletions after a successful Quit().

func (*Client) List

func (c *Client) List(id int) ([]MessageID, error)

List returns a list of (message ID, message Size) pairs. If the optional id > 0, then only that particular message is listed. The message IDs are sequential, 1 to N.

func (*Client) Noop

func (c *Client) Noop() error

Noop issues a do-nothing NOOP command to the server. This is useful for prolonging open connections.

func (*Client) Quit

func (c *Client) Quit() error

Quit sends the QUIT command to server and gracefully closes the connection. Message deletions (DELE command) are only excuted by the server on a graceful quit and close.

func (*Client) Retr

func (c *Client) Retr(id int) (string, error)

Retr downloads a message by the given id and returns the data of the entire message.

func (*Client) Rset

func (c *Client) Rset() error

Rset clears the messages marked for deletion in the current session.

func (*Client) Stat

func (c *Client) Stat() (count int, size int, err error)

Stat returns the number of messages and their total size in bytes in the inbox.

func (*Client) Top

func (c *Client) Top(id int, numLines int) (string, error)

Top retrieves a message by its ID with full headers and numLines lines of the body.

func (*Client) Uidl

func (c *Client) Uidl(id int) ([]MessageID, error)

Uidl returns a list of (message ID, message UID) pairs. If the optional msgID is > 0, then only that particular message is listed. It works like Top() but only works on servers that support the UIDL command. Messages size field is not available in the UIDL response.

type MessageID

type MessageID struct {
	// ID is the numerical index (non-unique) of the message.
	ID   int
	Size int

	// UID is only present if the response is to the UIDL command.
	UID string
}

MessageID contains the ID and size of an individual message.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL