message

package
v0.0.0-...-38d8c38 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package message contains Message structure and implements every method on it.

Index

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 (msg *Message) AddTrackingUrl(url string)

func (*Message) ApplySettings

func (msg *Message) ApplySettings(settings []MessageSetting)

func (*Message) FormatAddress

func (msg *Message) FormatAddress(address, name string) string

FormatAddress formats an address and a name as a valid RFC 5322 address.

func (*Message) GetEmailBytes

func (msg *Message) GetEmailBytes(to string) []byte

Convert Message object into bytes

func (*Message) GetFrom

func (msg *Message) GetFrom() (string, error)

Get From address from Message model

func (*Message) GetHeader

func (msg *Message) GetHeader(field string) []string

GetHeader gets a header field.

func (*Message) GetRecipients

func (msg *Message) GetRecipients() ([]string, error)

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

func (msg *Message) SetAddressHeader(field, address, name string)

SetAddressHeader sets an address to the given header field.

func (*Message) SetDateHeader

func (msg *Message) SetDateHeader(field string, date time.Time)

SetDateHeader sets a date to the given header field.

func (*Message) SetHeader

func (msg *Message) SetHeader(field string, value ...string)

func (*Message) SetHeaders

func (msg *Message) SetHeaders(headers common.Header)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL