Documentation ¶
Overview ¶
Package message contains message handling logic.
Index ¶
- func MakeMetadata(m storage.Message) *event.MessageMetadata
- 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 StoreManager
- func (s *StoreManager) Deliver(from *policy.Origin, recipients []*policy.Recipient, recvdHeader string, ...) error
- func (s *StoreManager) GetMessage(mailbox, id string) (*Message, error)
- func (s *StoreManager) GetMetadata(mailbox string) ([]*event.MessageMetadata, error)
- 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) RemoveMessage(mailbox, id string) error
- func (s *StoreManager) SourceReader(mailbox, id string) (io.ReadCloser, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeMetadata ¶
func MakeMetadata(m storage.Message) *event.MessageMetadata
MakeMetadata populates Metadata from a storage.Message.
Types ¶
type Delivery ¶
type Delivery struct { Meta event.MessageMetadata Reader io.Reader }
Delivery is used to add a message to storage.
type Manager ¶
type Manager interface { Deliver( from *policy.Origin, recipients []*policy.Recipient, recvdHeader string, content []byte, ) error GetMetadata(mailbox string) ([]*event.MessageMetadata, 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) }
Manager is the interface controllers use to interact with messages.
type Message ¶
type Message struct { event.MessageMetadata // contains filtered or unexported fields }
Message holds both the metadata and content of a message.
func New ¶
func New(m event.MessageMetadata, e *enmime.Envelope) *Message
New constructs a new 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 StoreManager ¶
type StoreManager struct { AddrPolicy *policy.Addressing Store storage.Store ExtHost *extension.Host }
StoreManager is a message Manager backed by the storage.Store.
func (*StoreManager) Deliver ¶
func (s *StoreManager) Deliver( from *policy.Origin, recipients []*policy.Recipient, recvdHeader string, source []byte, ) 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) ([]*event.MessageMetadata, error)
GetMetadata returns a slice of metadata for the specified mailbox.
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) 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.