Documentation ¶
Overview ¶
Package message contains message handling logic.
Index ¶
- type Delivery
- func (d *Delivery) Date() time.Time
- func (d *Delivery) From() *mail.Address
- func (d *Delivery) ID() string
- func (d *Delivery) Mailbox() string
- func (d *Delivery) Seen() bool
- func (d *Delivery) Size() int64
- func (d *Delivery) Source() (io.ReadCloser, error)
- func (d *Delivery) Subject() string
- func (d *Delivery) To() []*mail.Address
- type Manager
- type Message
- type Metadata
- type StoreManager
- func (s *StoreManager) AddAllowedMailbox(mailbox string) error
- func (s *StoreManager) AddAllowedMailhost(host string, weight int) error
- func (s *StoreManager) CleanupExpiredMailbox(period time.Duration) int
- func (s *StoreManager) Deliver(to *policy.Recipient, from string, recipients []*policy.Recipient, ...) (string, error)
- func (s *StoreManager) GetMessage(mailbox, id string) (*Message, error)
- func (s *StoreManager) GetMetadata(mailbox string) ([]*Metadata, error)
- func (s *StoreManager) IsMailboxAllow(mailbox string, td time.Duration) bool
- func (s *StoreManager) KeepaliveAllowedMailbox(mailbox string) error
- func (s *StoreManager) ListMailhost() []storage.Mailhost
- func (s *StoreManager) MailboxForAddress(mailbox string) (string, error)
- func (s *StoreManager) MarkSeen(mailbox, id string) error
- func (s *StoreManager) PurgeMessages(mailbox string) error
- func (s *StoreManager) RemoveAllowedMailbox(mailbox string) error
- func (s *StoreManager) RemoveAllowedMailhost(id string) error
- func (s *StoreManager) RemoveMessage(mailbox, id string) error
- func (s *StoreManager) SourceReader(mailbox, id string) (io.ReadCloser, error)
- func (s *StoreManager) UpdateMailhost(id string, host string, weight int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Delivery ¶
Delivery is used to add a message to storage.
type Manager ¶
type Manager interface { Deliver( to *policy.Recipient, from string, recipients []*policy.Recipient, prefix string, content []byte, ) (id string, err error) GetMetadata(mailbox string) ([]*Metadata, error) GetMessage(mailbox, id string) (*Message, error) MarkSeen(mailbox, id string) error PurgeMessages(mailbox string) error RemoveMessage(mailbox, id string) error SourceReader(mailbox, id string) (io.ReadCloser, error) MailboxForAddress(address string) (string, error) //mailbox AddAllowedMailbox(string) error RemoveAllowedMailbox(string) error KeepaliveAllowedMailbox(string) error IsMailboxAllow(string string, duration time.Duration) bool CleanupExpiredMailbox(period time.Duration) int //mailhost AddAllowedMailhost(host string, weight int) error RemoveAllowedMailhost(id string) error UpdateMailhost(id string, host string, weight int) error ListMailhost() []storage.Mailhost }
Manager is the interface controllers use to interact with messages.
type Message ¶
type Message struct { Metadata // contains filtered or unexported fields }
Message holds both the metadata and content of a message.
func (*Message) Attachments ¶
Attachments returns the MIME attachments for the message.
func (*Message) Header ¶
func (m *Message) Header() textproto.MIMEHeader
Header returns the header map for this message.
func (*Message) MIMEErrors ¶
MIMEErrors returns MIME parsing errors and warnings.
type Metadata ¶
type Metadata struct { Mailbox string ID string From *mail.Address To []*mail.Address Date time.Time Subject string Size int64 Seen bool }
Metadata holds information about a message, but not the content.
type StoreManager ¶
StoreManager is a message Manager backed by the storage.Store.
func (*StoreManager) AddAllowedMailbox ¶
func (s *StoreManager) AddAllowedMailbox(mailbox string) error
func (*StoreManager) AddAllowedMailhost ¶
func (s *StoreManager) AddAllowedMailhost(host string, weight int) error
mailhost
func (*StoreManager) CleanupExpiredMailbox ¶
func (s *StoreManager) CleanupExpiredMailbox(period time.Duration) int
func (*StoreManager) Deliver ¶
func (s *StoreManager) Deliver( to *policy.Recipient, from string, recipients []*policy.Recipient, prefix string, source []byte, ) (string, error)
Deliver submits a new message to the store.
func (*StoreManager) GetMessage ¶
func (s *StoreManager) GetMessage(mailbox, id string) (*Message, error)
GetMessage returns the specified message.
func (*StoreManager) GetMetadata ¶
func (s *StoreManager) GetMetadata(mailbox string) ([]*Metadata, error)
GetMetadata returns a slice of metadata for the specified mailbox.
func (*StoreManager) IsMailboxAllow ¶
func (s *StoreManager) IsMailboxAllow(mailbox string, td time.Duration) bool
func (*StoreManager) KeepaliveAllowedMailbox ¶
func (s *StoreManager) KeepaliveAllowedMailbox(mailbox string) error
func (*StoreManager) ListMailhost ¶
func (s *StoreManager) ListMailhost() []storage.Mailhost
func (*StoreManager) MailboxForAddress ¶
func (s *StoreManager) MailboxForAddress(mailbox string) (string, error)
MailboxForAddress parses an email address to return the canonical mailbox name.
func (*StoreManager) MarkSeen ¶
func (s *StoreManager) MarkSeen(mailbox, id string) error
MarkSeen marks the message as having been read.
func (*StoreManager) PurgeMessages ¶
func (s *StoreManager) PurgeMessages(mailbox string) error
PurgeMessages removes all messages from the specified mailbox.
func (*StoreManager) RemoveAllowedMailbox ¶
func (s *StoreManager) RemoveAllowedMailbox(mailbox string) error
func (*StoreManager) RemoveAllowedMailhost ¶
func (s *StoreManager) RemoveAllowedMailhost(id string) error
func (*StoreManager) RemoveMessage ¶
func (s *StoreManager) RemoveMessage(mailbox, id string) error
RemoveMessage deletes the specified message.
func (*StoreManager) SourceReader ¶
func (s *StoreManager) SourceReader(mailbox, id string) (io.ReadCloser, error)
SourceReader allows the stored message source to be read.
func (*StoreManager) UpdateMailhost ¶
func (s *StoreManager) UpdateMailhost(id string, host string, weight int) error