pop3

package module
v0.0.0-...-5d93371 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: LGPL-3.0 Imports: 7 Imported by: 0

README

Documentation

go-pop3-client

Simple POP3 client package for Go language (GoLang).

Documentation

Overview

Package pop3 provides simple POP3 client.

Index

Constants

View Source
const (
	// 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

View Source
var (
	// ErrAlreadyQuit is an error that is returned when an attempt to
	// write is made after the "QUIT" command is sent.
	ErrAlreadyQuit = fmt.Errorf("pop3: already quit from server")
	// ErrWriteAfterClose is an error that is returned when an attempt
	// to write is made after the connection is closed.
	ErrWriteAfterClose = fmt.Errorf("pop3: write after close")
)

Functions

This section is empty.

Types

type Client

type Client struct {

	// Reader is a pointer to a textproto.Reader struct.
	Reader *textproto.Reader
	// Writer is a pointer to a textproto.Writer struct.
	Writer *textproto.Writer
	// contains filtered or unexported fields
}

Client is a POP3 client.

func Dial

func Dial(addr string) (c *Client, err error)

Dial opens new connection and creates a new POP3 client.

func DialTLS

func DialTLS(addr string) (c *Client, err error)

DialTLS opens new TLS connection and creates a new POP3 client.

func NewClient

func NewClient(conn io.ReadWriteCloser) (c *Client, err error)

NewClient creates a new POP3 client.

func (*Client) Close

func (c *Client) Close() (err error)

Close sends "QUIT" command to POP3 server and closes connection.

func (*Client) GetMessages

func (c *Client) GetMessages() (list []Message, err error)

GetMessages requests messages lists from POP3 server.

func (*Client) Login

func (c *Client) Login(user, pass string) (err error)

Login logs into POP3 server with login and password.

func (*Client) NoOperation

func (c *Client) NoOperation() (msg string, err error)

NoOperation sends ping-like request to the POP3-server.

func (*Client) Quit

func (c *Client) Quit() (err error)

Quit sends "QUIT" command to the POP3 server.

type Error

type Error struct {
	// Context is context where an error happend.
	Context string
	// Err is an error.
	Err error
}

Error is a POP3 error.

func (Error) Error

func (e Error) Error() (s string)

Error returns POP3 error message.

type LineReader

type LineReader interface {
	// ReadLine reads a single line from reader.
	ReadLine() (line string, err error)
}

LineReader is an interface that has a ReadLine method.

type Message

type Message struct {
	// contains filtered or unexported fields
}

Message is a struct that helps working with POP3 messages.

func (*Message) Delete

func (m *Message) Delete() (msg string, err error)

Delete removes the message from the POP3 server.

func (*Message) GetSize

func (m *Message) GetSize() (n int64, err error)

GetSize returns a size of the message.

func (Message) Index

func (m Message) Index() (i int)

Index returns an index number of the message.

func (*Message) Retrieve

func (m *Message) Retrieve() (line string, msg *mail.Message, err error)

Retrieve retrieves the message body from the POP3 server.

Jump to

Keyboard shortcuts

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