sendinblue

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

README

SendInBlue

Simple Go library to send emails using the SendInBlue V3 API.

Additional features welcome by pull request.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

Address describes an email address

type Attachment

type Attachment struct {

	// Name is the filename to be asserted for this attachment
	Name string `json:"name"`

	// URL indicates an external reference from which the attachment content should be retrieved
	URL string `json:"url"`

	// Content declares the inline content of the attachment, encoded as a Base64 string
	Content string `json:"content"`
}

Attachment describes an attachment to an email message

func InlineAttachment

func InlineAttachment(name string, in io.Reader) (ret Attachment, err error)

InlineAttachment returns a new Attachment from a byte-wise reader source. The content will be converted to a Base64 string inside the Attachment.

type Message

type Message struct {

	// Sender is the entity which is sending the email message.  REQUIRED.
	Sender *Address `json:"sender"`

	// To is the list of primary recipients of the email
	To []*Address `json:"to,omitempty"`

	// Bcc (blind carbon copy) is the list of recipients of the email which should not be disclosed to other recipients
	Bcc []*Address `json:"bcc,omitempty"`

	// Cc (carbon copy) is the list of secondary recipients of the email
	Cc []*Address `json:"cc,omitempty"`

	// HTMLContent is the HTML-formatted content of the email
	HTMLContent string `json:"htmlContent,omitempty"`

	// TextContent is the plain-text content of the email
	TextContent string `json:"textContent,omitempty"`

	// Subject is the subject of the email
	Subject string `json:"subject,omitempty"`

	// ReplyTo indicates that replies to this email should be sent to this address
	ReplyTo *Address `json:"replyTo,omitempty"`

	// Attachments describe any attachments which should be added to this email
	Attachments []*Attachment `json:"attachment,omitempty"` // documentation indicates attachment (singular) even though multiple attachments are allowed

	// Headers is the list of email headers which should be sent with the email message
	Headers map[string]string `json:"headers,omitempty"`

	// TemplateID indicates that the content of the email address should be taken from the indicated template instead of directly-included content
	TemplateID int64 `json:"templateId,omitempty"`

	// Params is the list of parameters which should be used to populate the template
	Params map[string]string `json:"params,omitempty"`

	// Tags are arbitrary labels which are applied to this email in order to facilitate organizational operations in SendInBlue
	Tags []string `json:"tags,omitempty"`
}

Message describes an email message which should be sent

func (*Message) Send

func (m *Message) Send(apiKey string) error

Send transmits the email message to SendInBlue

Jump to

Keyboard shortcuts

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