message

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Content       []byte
	MimeType      string
	Name          string
	ContentID     string
	CustomHeaders []CustomHeader
}

Attachment info

func NewAttachment

func NewAttachment(filePath string) (Attachment, error)

NewAttachment Factory Constructor that creates attachment using content from specified file and path.

func NewAttachmentFromBytes

func NewAttachmentFromBytes(name string, mimeType string, content []byte) (Attachment, error)

NewAttachmentFromByteArray Factory Constructor that creates attachment using content from a byte array

func NewAttachmentFromFile

func NewAttachmentFromFile(name string, mimeType string, filePath string) (Attachment, error)

NewAttachmentFromFile Factory Constructor that creates attachment using content from specified file and path.

func (*Attachment) AddCustomHeader

func (attachment *Attachment) AddCustomHeader(name string, value string)

AddCustomHeader adds a custom header to the attachment

type BasicMessage

type BasicMessage struct {

	//The message subject.
	Subject string

	// Plain text portion of the message body.
	// (Optional) Either TextBody or HtmlBody must be used with the AmpBody or use a ApiTemplate
	PlainTextBody string

	// HTML portion of the message body.
	// (Optional) Either TextBody or HtmlBody must be used with the AmpBody or use a ApiTemplate
	HtmlBody string

	// AMP portion of the message body.
	// (Optional) Either TextBody or HtmlBody must be used with the AmpBody or use a ApiTemplate
	AmpBody string

	// Api Template for the message body.
	// (Optional) Either TextBody or HtmlBody must be used with the AmpBody or use a ApiTemplate
	ApiTemplate string

	//Custom MailingId for the message.
	//See https://www.socketlabs.com/blog/best-practices-for-using-custom-mailingids-and-messageids/ for more information.
	//(Optional)
	MailingId string

	//Custom MessageId for the message.
	//(Optional)
	MessageId string

	//From Address for the message.
	From EmailAddress

	//ReplyTo Address for the message.
	//(Optional)
	ReplyTo EmailAddress

	//The optional character set for the message.
	//(Optional)
	CharSet string

	//Optional collection of message attachments.
	//(Optional)
	Attachments []Attachment

	//Optional collection of custom headers for the message.
	//(Optional)
	CustomHeaders []CustomHeader

	//Collection of To Recipients for the message.
	To []EmailAddress

	//Collection of CC Recipients for the message.
	Cc []EmailAddress

	//Collection of BCC Recipients for the message.
	Bcc []EmailAddress
}

BasicMessage is a message similar to one created in a personal email client such as Outlook. This message can have many recipients of different types, such as To, CC, and BCC. This message does not support merge fields.

func (*BasicMessage) AddBccEmailAddress

func (basic *BasicMessage) AddBccEmailAddress(email string)

AddBccEmailAddress adds an email address to the Bcc Recipients collection

func (*BasicMessage) AddBccFriendlyEmailAddress

func (basic *BasicMessage) AddBccFriendlyEmailAddress(email string, friendly string)

AddBccFriendlyEmailAddress adds an email address paired with a friendlyname to the Bcc Recipients collection

func (*BasicMessage) AddCcEmailAddress

func (basic *BasicMessage) AddCcEmailAddress(email string)

AddCcEmailAddress adds an email address to the Cc Recipients collection

func (*BasicMessage) AddCcFriendlyEmailAddress

func (basic *BasicMessage) AddCcFriendlyEmailAddress(email string, friendly string)

AddCcFriendlyEmailAddress adds an email address paired with a friendlyname to the Cc Recipients collection

func (*BasicMessage) AddCustomHeader

func (basic *BasicMessage) AddCustomHeader(name string, value string)

AddCustomHeader adds a custom header to the message

func (*BasicMessage) AddToEmailAddress

func (basic *BasicMessage) AddToEmailAddress(email string)

AddToEmailAddress adds an email address to the To Recipients collection

func (*BasicMessage) AddToFriendlyEmailAddress

func (basic *BasicMessage) AddToFriendlyEmailAddress(email string, friendly string)

AddToFriendlyEmailAddress adds an email address paired with a friendlyname to the To Recipients collection

type BulkMessage

type BulkMessage struct {

	//The message subject.
	Subject string

	// Plain text portion of the message body.
	// (Optional) Either TextBody or HtmlBody must be used with the AmpBody or use a ApiTemplate
	PlainTextBody string

	// HTML portion of the message body.
	// (Optional) Either TextBody or HtmlBody must be used with the AmpBody or use a ApiTemplate
	HtmlBody string

	// AMP portion of the message body.
	// (Optional) Either TextBody or HtmlBody must be used with the AmpBody or use a ApiTemplate
	AmpBody string

	// Api Template for the message body.
	// (Optional) Either TextBody or HtmlBody must be used with the AmpBody or use a ApiTemplate
	ApiTemplate string

	//Custom MailingId for the message.
	//See https://www.socketlabs.com/blog/best-practices-for-using-custom-mailingids-and-messageids/ for more information.
	//(Optional)
	MailingId string

	//Custom MessageId for the message.
	//(Optional)
	MessageId string

	//From Address for the message.
	From EmailAddress

	//ReplyTo Address for the message.
	//(Optional)
	ReplyTo EmailAddress

	//The optional character set for the message.
	//(Optional)
	CharSet string

	// Optional collection of message attachments.
	// (Optional)
	Attachments []Attachment

	// Optional collection of custom headers for the message.
	// (Optional)
	CustomHeaders []CustomHeader

	//Collection of To Recipients for the message.
	To []BulkRecipient

	// Optional Merge data that is global across the whole message.
	// (Optional)
	Global map[string]string
}

BulkMessage usually contains a single recipient per message and is generally used to send the same content to many recipients, optionally customizing the message via the use of MergeData.

func (*BulkMessage) AddCustomHeader

func (bulk *BulkMessage) AddCustomHeader(name string, value string)

AddCustomHeader adds a custom header to the message

func (*BulkMessage) AddGlobalMergeData

func (bulk *BulkMessage) AddGlobalMergeData(key string, value string)

AddGlobalMergeData adds global merge data

func (*BulkMessage) AddToBulkRecipient

func (bulk *BulkMessage) AddToBulkRecipient(email string) BulkRecipient

AddToBulkRecipient add an email address to the To recipients collection

func (*BulkMessage) AddToFriendlyBulkRecipient

func (bulk *BulkMessage) AddToFriendlyBulkRecipient(email string, friendly string) BulkRecipient

AddToFriendlyBulkRecipient adds an email address paired with a friendly name to the To Recipients collection

type BulkRecipient

type BulkRecipient struct {
	FriendlyName string
	Email        string
	MergeData    map[string]string
}

BulkRecipient struct

func NewBulkRecipient

func NewBulkRecipient(email string) BulkRecipient

NewBulkRecipient Factory Constructor

func NewFriendlyBulkRecipient

func NewFriendlyBulkRecipient(email string, friendlyName string) BulkRecipient

NewFriendlyBulkRecipient Factory Constructor

func (*BulkRecipient) AddMergeData

func (recipient *BulkRecipient) AddMergeData(key string, value string) *BulkRecipient

AddGlobalMergeData adds global merge data

func (BulkRecipient) IsValid

func (e BulkRecipient) IsValid() bool

IsValid Determines if the Email Address is valid

type CustomHeader

type CustomHeader struct {
	Name  string
	Value string
}

CustomHeader info

func NewCustomHeader

func NewCustomHeader(name string, value string) CustomHeader

NewCustomHeader Factory Constructor

func (CustomHeader) IsValid

func (c CustomHeader) IsValid() bool

IsValid Determines if the CustomHeader is valid

type EmailAddress

type EmailAddress struct {
	FriendlyName string
	EmailAddress string
}

EmailAddress info

func NewEmailAddress

func NewEmailAddress(email string) EmailAddress

NewEmailAddress Factory Constructor

func NewFriendlyEmailAddress

func NewFriendlyEmailAddress(email string, friendlyName string) EmailAddress

NewFriendlyEmailAddress Factory Constructor

func (EmailAddress) IsValid

func (e EmailAddress) IsValid() bool

IsValid Determines if the Email Address is valid

Jump to

Keyboard shortcuts

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