Documentation
¶
Index ¶
Constants ¶
const IMAPDateFormat = "02-Jan-2006"
IMAPDateFormat is the date format used for IMAP SINCE.
Variables ¶
var MailboxInfoSpec = conf.SectionSpec{ { Name: "Host", Description: "The hostname of the IMAP mailbox server (including port)", Required: true, Type: conf.StringType, }, { Name: "TLS", Description: "Whether or not TLS should be used.", Default: "yes", Type: conf.BoolType, }, { Name: "InsecureSkipVerify", Description: "Insecurely skip certificate validation", Default: "no", Type: conf.BoolType, }, { Name: "User", Description: "The username of the mailbox", Type: conf.StringType, }, { Name: "Password", Description: "The password for the mailbox", Type: conf.StringType, }, { Name: "Folder", Description: "The mailbox folder", Type: conf.StringType, Default: "INBOX", }, { Name: "ReadOnly", Description: "Whether or not the mailbox should be opened readonly", Type: conf.BoolType, Default: "yes", }, }
MailboxInfoSpec describes the settings used to configure a IMAP mailbox.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is a mailbox client.
type Config ¶
type Config struct { Host string TLS bool InsecureSkipVerify bool User string Password string Folder string ReadOnly bool }
Config holds configuration values to connect to a IMAP mailbox.
type EMail ¶
type EMail struct { MultiPart // Raw provides raw access to the mail headers and the // body reader. Raw *mail.Message `json:"-"` // From holds the parsed FROM envelop. From *mail.Address `json:"from"` // To holds a parsed address list of the receipients. To []*mail.Address `json:"to"` // InternalDate is the date at which the email was received // by the mailbox. InternalDate time.Time `json:"internalDate"` // Precedence holds the precedence header value. Precedence string `json:"precedence"` // Subject holds the decoded subject of the mail. Subject string `json:"subject"` // UID is the mailbox specific UID value that identifies // this mail. Note that UID is only valid as long as the // mailbox UIDVALIDITY has changed. UID uint32 `json:"uid"` }
EMail represents a parsed E-Mail fetched from a mailbox.
type MultiPart ¶
type MultiPart struct { // MimeType is the parsed mime-type of this message part. MimeType string `json:"mimeType,omitempty"` // FileName is the name of the file as advertised by the // Content-Disposition header. FileName string `json:"filename,omitempty"` // Inline is set to true if this multi-part is sent as // inline in the Content-Disposition header. If false, // the Content-Disposition header has been set to "attachment". Inline bool `json:"inline,omitempty"` // Children holds all nested multipart message parts. // Only set if MimeType starts with multipart/. // Mutally exclusive with Body. Children []*MultiPart `json:"children,omitempty"` // Body is the actual body of the multipart message. Only set // if this part is not a multipart message by itself. Body []byte `json:"body,omitempty"` }
MultiPart is a multi-part email.
func ParseMIMEBody ¶
func ParseMIMEBody(ctx context.Context, partHeader textproto.MIMEHeader, rawBody io.Reader) (*MultiPart, error)
ParseMIMEBody parses the MIME payload from rawBody and partHeader. It supports parsing nested multipart MIME payloads.
func (*MultiPart) FindByFilename ¶
FindByFilename returns all multipart parts that have the filename name advertised in the Content-Disposition MIME header.
func (*MultiPart) FindByFilenameRegex ¶
FindByFilenameRegex is like FindByFilename but accepts a regular expression instead of a fixed name.
func (*MultiPart) FindByMIME ¶
FindByMIME searches for the body parts that matches mimeType. The mimeType may search for wildcard by using "*" for one or both parts of the mimetype. For example, "image/*" searches for all images while "*/*" returns everything.
func (*MultiPart) IsMultiPart ¶
IsMultiPart returns true if mp is a multipart message and may contain nested children.