Attachment defines an e-mail attachment. They are read lazily.
type Attachment struct { // Filename is the name to give the attachment in the email Filename string // Mimetype e.g. "application/pdf". // If an empty string, then attempts to automatically detect based on filename extension. Mimetype string // Reader is a lazy reader. e.g. return the result of os.Open. Reader func() (io.Reader, error) }
func FileAttachment(src string) *Attachment
FileAttachment returns an Attachment from a file path. The file at that path is lazily opened at the time the attachment is sent.
Envelope wraps an Email with some SMTP protocol information for extra control.
type Envelope struct { // From is the sender. Usually this should match the Email From address. In the cause of autoreplies (like "Out of // Office" or bounces or delivery status notifications) this should be an empty string to stop an infinite loop // of bounces) From string // Data is just a pointer to an Email struct Data *Message // ReceiptTo is normally automatically generated from the Email To/CC/BCC addresses ReceiptTo []string }
Messages defines a multipart e-mail (including headers, HTML body, plain text body, and attachments).
Use the `headers` parameter to specify additional headers. Note that `mail.Header` maps keys to a *list* of strings, because some headers may appear multiple times.
type Message struct { From mail.Address To []mail.Address Cc []mail.Address Bcc []mail.Address Subject string Headers mail.Header Html string Text string Attachments []*Attachment }
func (e *Message) Print(dest io.Writer) error
Print writes a multipart Email to dest.
NOTE: the maximum length of a email message line is 998 characters. If sending emails to multiple addresses the caller should keep this limit in mind and divide the addresses over multiple calls to this function.