Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MailBody ¶
type MailBody struct { TextBody string HTMLBody string Attachments []*attachment.Attachment }
func NewMailBody ¶
func NewMailBody(textBody, htmlBody string, attachments []*attachment.Attachment) *MailBody
func (*MailBody) Parse ¶
func (this *MailBody) Parse(contents string, contentType string, boundary string, transferEncoding string)
Parses a mail's DATA section. This will attempt to figure out what this mail contains. At the simples level it will contain a text message. A more complex example would be a multipart message with mixed text and HTML. It will also parse any attachments and retrieve their contents into an attachments array.
type MailHeader ¶
type MailHeader struct { ContentType string ContentTransferEncoding string Boundary string MIMEVersion string Subject string Date string XMailer string }
func NewMailHeader ¶
func NewMailHeader(contentType, boundary, mimeVersion, subject, date, xMailer string) *MailHeader
func (*MailHeader) Parse ¶
func (this *MailHeader) Parse(contents string)
Given an entire mail transmission this method parses a set of mail headers. It will split lines up and figures out what header data goes into what structure key. Most headers follow this format:
Header-Name: Some value here\r\n
However some headers, such as Content-Type, may have additiona information, especially when the content type is a multipart and there are attachments. Then it can look like this:
Content-Type: multipart/mixed; boundary="==abcsdfdfd=="\r\n
type MailItem ¶
type MailItem struct { Id string `json:"id"` DateSent string `json:"dateSent"` FromAddress string `json:"fromAddress"` ToAddresses []string `json:"toAddresses"` Subject string `json:"subject"` XMailer string `json:"xmailer"` Body string `json:"body"` ContentType string `json:"contentType"` Boundary string `json:"boundary"` Attachments []*attachment.Attachment `json:"attachments"` }
MailItem is a struct describing a parsed mail item. This is populated after an incoming client connection has finished sending mail data to this server.
func NewMailItem ¶
func NewMailItem(id, dateSent, fromAddress string, toAddresses []string, subject, xMailer, body, contentType, boundary string, attachments []*attachment.Attachment) *MailItem