Documentation ¶
Index ¶
- Variables
- func DomainToASCII(domain string) (string, error)
- func DomainToUnicode(domain string) (string, error)
- func NormalizeLocalPart(localPart string) string
- type Address
- type AddressEntity
- type DeliveryStatus
- type DomainEntity
- type MailEntity
- type MailboxCredentialEntity
- type MailboxEntity
- type RecipientEntity
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidAddressFormat is used for addresses of zero length or without // an "@" sign. ErrInvalidAddressFormat = errors.New("address: invalid format") // ErrPathTooLong is used for addresses, that are too long or contain a path // that is too long according to RFC#5321. ErrPathTooLong = errors.New("address: path too long") // ZeroAddress is an invalid, zero value Address. ZeroAddress Address )
Functions ¶
func DomainToASCII ¶
DomainToASCII transforms a unicode domain to punycode.
func DomainToUnicode ¶
DomainToUnicode normalizes a punycode domain to unicode and applies the NFC normal form.
func NormalizeLocalPart ¶
NormalizeLocalPart applie several rules to make the local-part of addresses comparable. This may only be applied to local addresses. Outbound addresses may not be altered.
1) The local-part is case-folded so that "user" and "USER" are considered equal. 2) The local-part is normalized using NFKC so that equal looking runes are considered equal. 3) The local-part has the suffix trimmed. A suffix is everything after the first '+' rune.
Types ¶
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
Address is a string of the form "local-part@domain".
func ParseNormalized ¶
ParseNormalized calls ParseUnicode and transforms the local-part using NormalizeLocalPart.
func ParseUnicode ¶
ParseUnicode calls Parse and transforms the domain part of the address using DomainToUnicode.
func (Address) Normalized ¶
Normalized returns a copy of a with a normalized local-part.
type AddressEntity ¶
type AddressEntity struct { ID int64 `db:"id"` LocalPart string `db:"local_part"` DomainID int64 `db:"domain_id"` MailboxID int64 `db:"mailbox_id"` }
AddressEntity is the entity for the "addresses" table.
type DeliveryStatus ¶
type DeliveryStatus int
DeliveryStatus indicates the status of delivery per recipient.
const ( // StatusFailed is a mail that could not be delivered after the final attempt. StatusFailed DeliveryStatus // StatusDelivered is a mail that reached its final destination. This is either a successful // outbound transmission or a local mail, that has been retrieved. StatusDelivered // StatusInboxed is a mail delivered, but not deleted, to a local mailbox. StatusInboxed // StatusPending is a mail queued for outbound transmision. StatusPending )
type DomainEntity ¶
DomainEntity is the entity for the "domains" table.
type MailEntity ¶
type MailEntity struct { ID string `db:"id"` ReceivedAt int64 `db:"received_at"` DeletedAt sql.NullInt64 `db:"deleted_at"` ReturnPath Address `db:"return_path"` Size int64 `db:"size"` AttemptCount int `db:"attempt_count"` LastAttemptedAt sql.NullInt64 `db:"last_attempted_at"` }
MailEntity is the entity for the "mails" table.
type MailboxCredentialEntity ¶
type MailboxCredentialEntity struct { MailboxID int64 `db:"mailbox_id"` UpdatedAt int64 `db:"updated_at"` Hash string `db:"hash"` }
MailboxCredentialEntity is the entity for the "mailbox_credentials" table.
type MailboxEntity ¶
MailboxEntity is the entity for the "mailboxes" table.
type RecipientEntity ¶
type RecipientEntity struct { ID int64 `db:"id"` MailID string `db:"mail_id"` MailboxID sql.NullInt64 `db:"mailbox_id"` ForwardPath Address `db:"forward_path"` Status DeliveryStatus `db:"status"` }
RecipientEntity is the entity for the "recipients" table.