Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrWrongAddressPassword is returned when an address either does not exist or the password // does not match the hash. ErrWrongAddressPassword = errors.New("wrong address or password combination") )
Functions ¶
This section is empty.
Types ¶
type Addressbook ¶
type Addressbook interface { // Lookup looks up an address without a transaction. See LookupTx. Lookup(context.Context, models.Address) (*LookupResult, error) // LookupTx looks up an address. The result indicates if the address belongs to a local domain // and if it does, if it exists. Only database errors may occur. LookupTx(context.Context, database.Queryer, models.Address) (*LookupResult, error) }
Addressbook is a registry to lookup mail addresses.
func NewAddressbook ¶
func NewAddressbook( db database.Conn, domainDao database.DomainDao, mailboxDao database.MailboxDao, ) Addressbook
NewAddressbook creates a new Addressbook.
type Authenticator ¶
type Authenticator interface { // Auth searches for a mailbox by address. If the address does not exist, is not local or the // password does not match the stored hash, ErrWrongAddressPassword is returned. Database errors // may occur. Auth(ctx context.Context, name, pass []byte) (*models.MailboxEntity, error) }
Authenticator is for authentication of users based on their addresses.
func NewAuthenticator ¶
func NewAuthenticator( db database.Conn, mailboxCredentialDao database.MailboxCredentialDao, addressbook Addressbook, ) Authenticator
NewAuthenticator creates a new Authenticator.
type Cleaner ¶
type Cleaner interface { // Clean finds all orphaned mails and deletes them. An orphaned mail is a mail not assigned to a // mailbox and not queued for outbound delivery. Clean(ctx context.Context) error }
Cleaner is a service to clean orphaned mail blobs and their database counterparts.
type Courier ¶
type Courier struct {
// contains filtered or unexported fields
}
Courier handles the delivery of outbound mails.
func NewCourier ¶
func NewCourier( db database.Conn, mailDao database.MailDao, recipientDao database.RecipientDao, blobs storage.Blobs, ) *Courier
NewCourier creates a new courier for delivery.
func (*Courier) SendMail ¶
func (c *Courier) SendMail(ctx context.Context, mail *models.MailEntity) (SendResult, error)
SendMail attempts to send a mail to all pending recipients. An error is only returned on database errors. Other errors are logged but only affect the SendResult. After the attempt, the mail attempt count and the status of all pending recipients is updated and stored in the database.
type Envelope ¶
type Envelope struct { // Helo is the string provided by an smtp client when greeting the server. Helo string // Addr is the remote address of the sender. Addr net.IP // Date is the time when the data transmission begins. Date time.Time // From is the email-address of the sender. From models.Address // To is a list of recipient email-addresses. To []models.Address }
Envelope stores the information about an email before the actual content is read. It is basically what a real envelope is to mail.
type Inbox ¶
type Inbox struct { Mails []models.MailEntity // contains filtered or unexported fields }
Inbox is a list of unreal mails as well as a set of "marks". Marked mails are removed, when the inbox state is committed.
type Inboxer ¶
type Inboxer struct {
// contains filtered or unexported fields
}
Inboxer is service to read a list of unread mails of a mailbox and committing changes later.
func NewInboxer ¶
NewInboxer creates a new Inboxer.
type LookupResult ¶
type LookupResult struct { // Address is the address used for lookup. Address models.Address // IsLocal indicates if the domain part of the address is local. This does not imply that the // address exists. IsLocal bool // Mailbox is the local mailbox of an address, if it is local and exists. If Mailbox is not nil // IsLocal is implied to be true. Mailbox *models.MailboxEntity }
LookupResult is the result of an address lookup.
type Mailman ¶
type Mailman struct {
// contains filtered or unexported fields
}
Mailman handles the delivery of local mails into mailboxes as well as queuing outbound delivery.
func NewMailman ¶
func NewMailman( db database.Conn, mailDao database.MailDao, recipientDao database.RecipientDao, blobs storage.Blobs, addressbook Addressbook, queue *Queue, ) *Mailman
NewMailman creates a new mailman for delivery.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue coordinates the delivery attempts of outbound mails.
type SendResult ¶
type SendResult int
SendResult indicates the status of delivery for a collection of recipients.
const ( // SomePending means at least one recipient is still pending, because of a transient error. SomePending SendResult // SomeFailed means at least one recipient permanently failed. SomeFailed // SomeSuccess means at least one recipient was delivered succesfully. SomeSuccess )