email

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2016 License: Apache-2.0 Imports: 13 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"
)
View Source
const (
	SmtpEmailerType = "smtp"
)

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 {
}

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 {
	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 SmtpEmailerConfig added in v0.2.0

type SmtpEmailerConfig struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Auth     string `json:"auth"`
	Username string `json:"username"`
	Password string `json:"password"`
}

func (SmtpEmailerConfig) Emailer added in v0.2.0

func (cfg SmtpEmailerConfig) Emailer() (Emailer, error)

func (SmtpEmailerConfig) EmailerID added in v0.2.0

func (cfg SmtpEmailerConfig) EmailerID() string

func (SmtpEmailerConfig) EmailerType added in v0.2.0

func (cfg SmtpEmailerConfig) EmailerType() string

func (*SmtpEmailerConfig) UnmarshalJSON added in v0.2.0

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

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.

func (*TemplatizedEmailer) SetGlobalContext added in v0.2.0

func (t *TemplatizedEmailer) SetGlobalContext(ctx map[string]interface{})

Jump to

Keyboard shortcuts

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