mail

package
v0.0.0-...-a53e0fd Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClientNotConnected error = errors.New("client is not connected")

Functions

func ResolveAddedAndRemoved

func ResolveAddedAndRemoved(a, b []uint32) ([]uint32, []uint32)

Types

type Account

type Account struct {
	Username, Password string
}

type Client

type Client interface {
	Connect(address string, account Account) error
	FetchMailbox(Account, string, bool) (Mailbox, error)
	FetchAllMailboxes(Account) ([]Mailbox, error)

	Close() error
	// contains filtered or unexported methods
}

func NewClient

func NewClient(db kvs.DB) Client

type Mailbox

type Mailbox interface {
	Name() string
	FetchAllMessages() ([]Message, error)
	FetchAllMessageUIDs() ([]MessageUID, error)
}

type Message

type Message struct {
	Subject string
}

type MessageHeader

type MessageHeader struct {
	MessageUID
}

type MessageUID

type MessageUID uint32

type MockSMTPServer

type MockSMTPServer struct{}

func (*MockSMTPServer) NewSession

func (ms *MockSMTPServer) NewSession(_ *smtp.Conn) (smtp.Session, error)

type Session

type Session struct{}

func (*Session) AuthPlain

func (s *Session) AuthPlain(username, password string) error

Authenticate the user using SASL PLAIN.

func (*Session) Data

func (s *Session) Data(r io.Reader) error

Set currently processed message contents and send it.

r must be consumed before Data returns.

func (*Session) Logout

func (s *Session) Logout() error

Free all resources associated with session.

func (*Session) Mail

func (s *Session) Mail(from string, opts *smtp.MailOptions) error

Set return path for currently processed message.

func (*Session) Rcpt

func (s *Session) Rcpt(to string) error

Add recipient for currently processed message.

func (*Session) Reset

func (s *Session) Reset()

Discard currently processed message.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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