localmail

package module
v0.0.0-...-ef92531 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: MIT Imports: 15 Imported by: 0

README

Local Mail

Heavy inspired by python implementation localmail (which works on python2) and description has been partially copied.

go-localmail is an SMTP and IMAP server that stores all messages into a single in-memory mailbox. It is designed to be used to speed up running test suites on systems that send email, such as new account sign up emails with confirmation codes. It can also be used to test SMTP/IMAP client code.

Features:

  • Fast and robust IMAP/SMTP implementations, including multipart messages and unicode support.
  • Compatible with python's stdlib clients.
  • Authentication based on password length, correct only passwords longer then 6 chars.
  • SSL support

WARNING : not a real SMTP/IMAP server - not for production usage.

Running go-localmail

go-localmail

This will run localmail in the foreground, SMTP on port 2025 and IMAP on 2993.

You can pass in arguments to control parameters

go-localmail -imap <port> -smtp <port> -cert <path>

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Delimiter = "/"

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Users map[string]*User
}

func NewBackend

func NewBackend() *Backend

func (*Backend) IMAP

func (back *Backend) IMAP() *imapBackend

func (*Backend) SMTP

func (back *Backend) SMTP() *smtpBackend

type Mailbox

type Mailbox struct {
	Subscribed bool
	Messages   []*Message
	// contains filtered or unexported fields
}

func (*Mailbox) Check

func (mbox *Mailbox) Check() error

func (*Mailbox) CopyMessages

func (mbox *Mailbox) CopyMessages(uid bool, seqset *imap.SeqSet, destName string) error

func (*Mailbox) CreateMessage

func (mbox *Mailbox) CreateMessage(flags []string, date time.Time, body imap.Literal) error

func (*Mailbox) Expunge

func (mbox *Mailbox) Expunge() error

func (*Mailbox) Info

func (mbox *Mailbox) Info() (*imap.MailboxInfo, error)

func (*Mailbox) ListMessages

func (mbox *Mailbox) ListMessages(uid bool, seqSet *imap.SeqSet, items []imap.FetchItem, ch chan<- *imap.Message) error

func (*Mailbox) Name

func (mbox *Mailbox) Name() string

func (*Mailbox) SearchMessages

func (mbox *Mailbox) SearchMessages(uid bool, criteria *imap.SearchCriteria) ([]uint32, error)

func (*Mailbox) SetSubscribed

func (mbox *Mailbox) SetSubscribed(subscribed bool) error

func (*Mailbox) Status

func (mbox *Mailbox) Status(items []imap.StatusItem) (*imap.MailboxStatus, error)

func (*Mailbox) UpdateMessagesFlags

func (mbox *Mailbox) UpdateMessagesFlags(uid bool, seqset *imap.SeqSet, op imap.FlagsOp, flags []string) error

type Message

type Message struct {
	Uid    uint32
	Header mail.Header
	Date   time.Time
	Size   uint32
	Flags  []string
	Body   []byte
}

func (*Message) Fetch

func (m *Message) Fetch(seqNum uint32, items []imap.FetchItem) (*imap.Message, error)

func (*Message) Match

func (m *Message) Match(seqNum uint32, c *imap.SearchCriteria) (bool, error)

type User

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

func NewUser

func NewUser(username string) *User

func (*User) CreateMailbox

func (u *User) CreateMailbox(name string) error

func (*User) DeleteMailbox

func (u *User) DeleteMailbox(name string) error

func (*User) GetMailbox

func (u *User) GetMailbox(name string) (mailbox backend.Mailbox, err error)

func (*User) ListMailboxes

func (u *User) ListMailboxes(subscribed bool) (mailboxes []backend.Mailbox, err error)

func (*User) Logout

func (u *User) Logout() error

func (*User) RenameMailbox

func (u *User) RenameMailbox(existingName, newName string) error

func (*User) Username

func (u *User) Username() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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