Documentation ¶
Overview ¶
Package message contains Message structure and implements every method on it.
Index ¶
- type Message
- func (msg *Message) AddTrackingUrl(url string)
- func (msg *Message) ApplySettings(settings []MessageSetting)
- func (msg *Message) FormatAddress(address, name string) string
- func (msg *Message) GetEmailBytes(to string) []byte
- func (msg *Message) GetFrom() (string, error)
- func (msg *Message) GetHeader(field string) []string
- func (msg *Message) GetRecipients() ([]string, error)
- func (msg *Message) Reset()
- func (msg *Message) SetAddressHeader(field, address, name string)
- func (msg *Message) SetDateHeader(field string, date time.Time)
- func (msg *Message) SetHeader(field string, value ...string)
- func (msg *Message) SetHeaders(headers common.Header)
- type MessageSetting
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 an email.
func NewMessage ¶
func NewMessage(subject, body, emailType string, settings ...MessageSetting) *Message
func (*Message) AddTrackingUrl ¶
func (*Message) ApplySettings ¶
func (msg *Message) ApplySettings(settings []MessageSetting)
func (*Message) FormatAddress ¶
FormatAddress formats an address and a name as a valid RFC 5322 address.
func (*Message) GetEmailBytes ¶
Convert Message object into bytes
func (*Message) GetRecipients ¶
Get list of recipients(To, Cc, Bcc) from Message object
func (*Message) Reset ¶
func (msg *Message) Reset()
Reset resets the message so it can be reused. The message keeps its previous settings so it is in the same state that after a call to NewMessage.
func (*Message) SetAddressHeader ¶
SetAddressHeader sets an address to the given header field.
func (*Message) SetDateHeader ¶
SetDateHeader sets a date to the given header field.
func (*Message) SetHeaders ¶
SetHeaders sets the message headers.
type MessageSetting ¶
type MessageSetting func(m *Message)
A MessageSetting can be used as an argument in NewMessage to configure an email.
func SetCharset ¶
func SetCharset(charset string) MessageSetting
SetCharset is a message setting to set the charset of the email.
func SetEncoding ¶
func SetEncoding(enc common.Encoding) MessageSetting
SetEncoding is a message setting to set the encoding of the email.