Documentation ¶
Index ¶
- type Message
- func (m *Message) AddAttachment(attachment *attachments.EmbeddedBinaryObject, err error) error
- func (m *Message) AddMailHeader(key, value string)
- func (m *Message) GenerateMessage() (*bytes.Buffer, error)
- func (m *Message) RemoveAttachment(filename string)
- func (m *Message) SetHTMLBody(body *body.MailBody, images ...*attachments.EmbeddedBinaryObject)
- func (m *Message) SetTextBody(body *body.MailBody)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message represents a mail message to be sent. At the very minimum a message must contain a from address, a to address. Everything else is optional.
func NewEmpty ¶
func NewEmpty() *Message
NewEmpty creates a new go-mail Message object that is completely empty (no headers). You must use this to create an empty Message object as there are internal members that need to be instantiated.
func NewSimple ¶
func NewSimple(from string, to string, subject string, bodyText string, attachmentFilePaths ...string) (*Message, error)
NewSimple creates a simple go-mail Message with a bare minimum of headers set. The following lists the headers set and their values. "From" - with the address provided. "To" - with the address provided. To add more, use the AddMailHeader method and headers.To() helper function. "MIME-Version" - "1.0"
Addresses can be in the following formats - Simple Email - chris.tomich@email.com Email with Name - Chris Tomich <chris.tomich@email.com>
func (*Message) AddAttachment ¶
func (m *Message) AddAttachment(attachment *attachments.EmbeddedBinaryObject, err error) error
AddAttachment will add an attachment to the email.
func (*Message) AddMailHeader ¶
AddMailHeader adds a header to the email given the key and value. Look in the headers package to see a number of helpers for potential headers.
func (*Message) GenerateMessage ¶
GenerateMessage will create a buffer containing the email message in it's current state.
func (*Message) RemoveAttachment ¶
RemoveAttachment will remove the attachment from the email.
func (*Message) SetHTMLBody ¶
func (m *Message) SetHTMLBody(body *body.MailBody, images ...*attachments.EmbeddedBinaryObject)
SetHTMLBody will set/overwrite the body for the HTML portion of the email and override all currently stored images. This body is additional to the text-only body and does not impact anything set with SetTextBody().
func (*Message) SetTextBody ¶
SetTextBody will set/overwrite the body for the text-only portion of the email. This body is additional to the HTML body and does not impact anything set with SetHTMLBody().