Documentation
¶
Overview ¶
Package email is for the construction of email messages.
The defaults of this package are to create RFC5322 compliant messages that are accepted and usable by the majority of existing, popular email clients.
Index ¶
- Variables
- type Email
- func (e *Email) AddBcc(a ...mail.Address)
- func (e *Email) AddCc(a ...mail.Address)
- func (e *Email) AddHTMLBody(r io.Reader) error
- func (e *Email) AddHeader(key, value string) error
- func (e *Email) AddTextBody(r io.Reader) error
- func (e *Email) AddTextBodyString(s string) error
- func (e *Email) AddTo(a ...mail.Address)
- func (e *Email) Bytes(m Mode) ([]byte, error)
- func (e *Email) WriteTo(w io.Writer, m Mode) error
- type MIME
- type MIMEMultipart
- type MIMEPartBinary
- type MIMEPartText
- type Mode
Constants ¶
This section is empty.
Variables ¶
var ( ErrFromRequired = errors.New("email: From is required") ErrInvalidMimeTree = errors.New("email: Ambigious MIME tree for inserting text or attachment") ErrNoBody = errors.New("email: body is missing") )
var BoundaryGenerator = func(p *MIMEMultipart) string {
return "boundary"
}
Function to generate a boundary for a multipart message
var MessageIDGenerator = func(p *Email) string {
return "messageid"
}
Function to generate message ids
Functions ¶
This section is empty.
Types ¶
type Email ¶
type Email struct { From mail.Address To, Cc, Bcc, ReplyTo []mail.Address // Defaults to Now Date time.Time Subject string // This will be auto generated if not provided MessageId string // Optional headers Headers textproto.MIMEHeader // Actual message Message MIME }
An email contains all field needing for constructing the message. The actual message is a tree of email (MIME) parts.
func (*Email) AddHeader ¶
Add a header to the message. These headers are not validated, and headers that are represented in another field are throwing an error.
func (*Email) AddTextBody ¶
Add a text body to this message. The text must be UTF-8. Adding multiple text bodies is not recommended, but will not throw an error.
func (*Email) AddTextBodyString ¶
Add a text body to this message. The text must be UTF-8. Adding multiple text bodies is not recommended, but will not throw an error.
type MIMEMultipart ¶
type MIMEMultipart struct { Type string Headers textproto.MIMEHeader Boundary string Parts []MIME }