email

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

DO NOT EDIT: This file was auto-generated by "go generate" To regenerate run:

go install github.com/coreos/dex/cmd/genconfig
go generate <<fully qualified package name>>

Index

Constants

View Source
const (
	FakeEmailerType = "fake"
)
View Source
const (
	MailgunEmailerType = "mailgun"
)

Variables

View Source
var (
	ErrorNoTemplate = errors.New("No HTML or Text template found for template name.")
)

Functions

func RegisterEmailerConfigType

func RegisterEmailerConfigType(emailerType string, fn NewEmailerConfigFunc)

Types

type Emailer

type Emailer interface {
	// SendMail queues an email to be sent to 1 or more recipients.
	// At least one of "text" or "html" must not be blank. If text is blank, but
	// html is not, then an html-only email should be sent and vice-versal.
	SendMail(from, subject, text, html string, to ...string) error
}

Emailer is an object that sends emails.

type EmailerConfig

type EmailerConfig interface {
	EmailerID() string
	EmailerType() string
	Emailer() (Emailer, error)
}

func NewEmailerConfigFromFile

func NewEmailerConfigFromFile(loc string) (EmailerConfig, error)

func NewEmailerConfigFromType

func NewEmailerConfigFromType(emailerType string) (EmailerConfig, error)

type FakeEmailer

type FakeEmailer struct{}

FakeEmailer is an Emailer that writes emails to stdout. Should only be used in development.

func (FakeEmailer) SendMail

func (f FakeEmailer) SendMail(from, subject, text, html string, to ...string) error

type FakeEmailerConfig

type FakeEmailerConfig struct {
	ID string `json:"id"`
}

func (FakeEmailerConfig) Emailer

func (cfg FakeEmailerConfig) Emailer() (Emailer, error)

func (FakeEmailerConfig) EmailerID

func (cfg FakeEmailerConfig) EmailerID() string

func (FakeEmailerConfig) EmailerType

func (cfg FakeEmailerConfig) EmailerType() string

type MailgunEmailerConfig

type MailgunEmailerConfig struct {
	ID            string `json:"id"`
	PrivateAPIKey string `json:"privateAPIKey"`
	PublicAPIKey  string `json:"publicAPIKey"`
	Domain        string `json:"domain"`
}

func (MailgunEmailerConfig) Emailer

func (cfg MailgunEmailerConfig) Emailer() (Emailer, error)

func (MailgunEmailerConfig) EmailerID

func (cfg MailgunEmailerConfig) EmailerID() string

func (MailgunEmailerConfig) EmailerType

func (cfg MailgunEmailerConfig) EmailerType() string

func (*MailgunEmailerConfig) UnmarshalJSON

func (cfg *MailgunEmailerConfig) UnmarshalJSON(data []byte) error

type NewEmailerConfigFunc

type NewEmailerConfigFunc func() EmailerConfig

type TemplatizedEmailer

type TemplatizedEmailer struct {
	// contains filtered or unexported fields
}

TemplatizedEmailer sends emails based on templates, using any Emailer.

func NewTemplatizedEmailerFromGlobs

func NewTemplatizedEmailerFromGlobs(textGlob, htmlGlob string, emailer Emailer) (*TemplatizedEmailer, error)

NewTemplatizedEmailerFromGlobs creates a new TemplatizedEmailer, parsing the templates found in the given filepattern globs.

func NewTemplatizedEmailerFromTemplates

func NewTemplatizedEmailerFromTemplates(textTemplates *template.Template, htmlTemplates *htmltemplate.Template, emailer Emailer) *TemplatizedEmailer

NewTemplatizedEmailerFromTemplates creates a new TemplatizedEmailer, given root text and html templates.

func (*TemplatizedEmailer) SendMail

func (t *TemplatizedEmailer) SendMail(from, subject, tplName string, data map[string]interface{}, to string) error

SendMail queues an email to be sent to a recipient. SendMail has similar semantics to Emailer.SendMail, except that you provide the template names you want to base the message on instead of the actual text. "to", "from" and "subject" will be added into the data map regardless of if they are used.

Jump to

Keyboard shortcuts

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