Documentation
¶
Overview ¶
Package mailtest is an in-memory mail.Mailbox for tests of the packages that sit on top of the connector. It keeps the same promises as the IMAP one: UIDs only grow, a moved message gets a new UID in its destination, fetching never sets \Seen, and a reference with the wrong UIDVALIDITY finds nothing.
Index ¶
- type Mailbox
- func (m *Mailbox) AddFolder(name, role string)
- func (m *Mailbox) Capabilities() mail.Caps
- func (m *Mailbox) Close() error
- func (m *Mailbox) Deliver(folderName, eml string, flags ...string) mail.MsgRef
- func (m *Mailbox) EnsureFolder(ctx context.Context, name string) error
- func (m *Mailbox) Fetch(ctx context.Context, ref mail.MsgRef, maxBody int) (*message.Raw, error)
- func (m *Mailbox) FetchMany(ctx context.Context, refs []mail.MsgRef, maxBody int) ([]*message.Raw, error)
- func (m *Mailbox) FetchSince(ctx context.Context, name string, since time.Time, limit int) ([]mail.MsgRef, int, error)
- func (m *Mailbox) FindByMessageID(ctx context.Context, name, messageID string) (mail.MsgRef, error)
- func (m *Mailbox) Flags(ctx context.Context, ref mail.MsgRef) ([]string, error)
- func (m *Mailbox) Folders(ctx context.Context) ([]mail.Folder, error)
- func (m *Mailbox) Move(ctx context.Context, ref mail.MsgRef, dest string) (mail.MsgRef, error)
- func (m *Mailbox) SentRecipients(ctx context.Context, name string, limit int) ([]mail.Recipient, error)
- func (m *Mailbox) SetFlags(ctx context.Context, ref mail.MsgRef, add, remove []string) error
- func (m *Mailbox) Status(ctx context.Context, name string) (mail.FolderStatus, error)
- func (m *Mailbox) Watch(ctx context.Context, name string, lastUID uint32, out chan<- mail.NewMail) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mailbox ¶
Mailbox is the fake. Set Caps before use to simulate a limited server.
func (*Mailbox) AddFolder ¶
AddFolder creates a folder with a special-use role ("" for none). Re-adding an existing name rebuilds it empty with a new UIDVALIDITY.
func (*Mailbox) Capabilities ¶
Capabilities returns Caps.
func (*Mailbox) Deliver ¶
Deliver puts an RFC 5322 message into a folder, as new mail arriving, and wakes watchers.
func (*Mailbox) EnsureFolder ¶
EnsureFolder creates the folder if it is missing.
func (*Mailbox) Fetch ¶
Fetch returns a copy of the message with its text cut to maxBody bytes. Flags are untouched.
func (*Mailbox) FetchMany ¶
func (m *Mailbox) FetchMany(ctx context.Context, refs []mail.MsgRef, maxBody int) ([]*message.Raw, error)
FetchMany returns a copy of each message, like Fetch, and nil for one that is gone.
func (*Mailbox) FetchSince ¶
func (m *Mailbox) FetchSince(ctx context.Context, name string, since time.Time, limit int) ([]mail.MsgRef, int, error)
FetchSince lists messages delivered at or after since, oldest first, newest limit only.
func (*Mailbox) FindByMessageID ¶
FindByMessageID returns the newest message in the folder with that Message-ID.
func (*Mailbox) SentRecipients ¶
func (m *Mailbox) SentRecipients(ctx context.Context, name string, limit int) ([]mail.Recipient, error)
SentRecipients returns the To and Cc addresses of the newest limit messages.