mailer

package
v0.0.0-...-a114734 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Emailer represent the mailer to be used to send email
	Emailer *Mailer

	// StacktraceTemplateID represents the sendgrid template ID for the
	// stack trace email
	StacktraceTemplateID string
)

Functions

This section is empty.

Types

type Mailer

type Mailer struct {
	APIKey      string
	DefaultFrom string
	DefaultTo   string
}

Mailer is an object used to send email

func NewMailer

func NewMailer(APIKey, defaultFrom, defaultTo string) *Mailer

NewMailer creates and returns a new mailer

func (*Mailer) Send

func (m *Mailer) Send(msg *Message) error

Send is used to send an email

func (*Mailer) SendStackTrace

func (m *Mailer) SendStackTrace(trace []byte, endpoint string, message string, id string) error

SendStackTrace emails the current stacktrace to the default FROM

type Message

type Message struct {
	TemplateID string
	From       string
	To         string
	Subject    string
	Body       string
	Vars       map[string]string
}

Message represents a message to send

func NewMessage

func NewMessage(templateID string) *Message

NewMessage creates a new message from a template

func (*Message) SetVar

func (msg *Message) SetVar(name string, value string)

SetVar set a variable to the message

Jump to

Keyboard shortcuts

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