Documentation
¶
Overview ¶
Package mailtoolkit parses a raw RFC 5322 / MIME email into a Mail object.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct {
ContentInfo ContentInfo
Data []byte
}
Attachment is an attached file. Data is still transfer-encoded, use Decode to get the raw bytes.
func (Attachment) Decode ¶
func (a Attachment) Decode() ([]byte, error)
Decode returns the attachment data with its Content-Transfer-Encoding removed.
type Content ¶
type Content struct {
ContentInfo ContentInfo
Data []byte
}
Content is a displayable part of a mail. Data is still transfer-encoded, use Decode to get the raw bytes.
type ContentDisposition ¶
ContentDisposition is a parsed Content-Disposition field. Type and parameter names are lowercase.
type ContentInfo ¶
type ContentInfo struct {
Type ContentType
ID string
Description string
TransferEncoding string
Disposition ContentDisposition
}
ContentInfo describes a MIME part.
type ContentType ¶
ContentType is a parsed Content-Type field. Type, Subtype and parameter names are lowercase.
type Header ¶
type Header struct {
IsMime bool
// From, To, Cc and Bcc are comma separated lists of e-mail addresses.
// When the mail has no To field, To falls back to Delivered-To.
From string
To string
Cc string
Bcc string
// FromList, ToList, CcList and BccList keep the display names.
FromList []*mail.Address
ToList []*mail.Address
CcList []*mail.Address
BccList []*mail.Address
// Date is the raw Date field, Time its parsed value (zero if unparsable).
Date string
Time time.Time
Subject string
// Elements contains every header field, keyed by lowercase name.
// Repeated fields are joined with "\n".
Elements map[string]string
ContentInfo ContentInfo
}
Header holds the top-level header fields of a mail.
func ParseHeader ¶
ParseHeader parses only the header of a raw email.
type Mail ¶
type Mail struct {
Header Header
// Contents are the displayable parts of the mail, keyed by Content-ID
// (without angle brackets) or, when the part has no Content-ID, by its
// position ("0", "1", ...).
Contents map[string]Content
// Attachments are keyed by their decoded file name, made unique when
// several attachments share the same name.
Attachments map[string]Attachment
}
Mail is a parsed email.