email

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2018 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoReply = env.MustGet("EMAIL_NOREPLY")

NoReply is the default 'from' address

Functions

func CanSendTo added in v0.10.0

func CanSendTo(address string) bool

CanSendTo returns true if Fider is allowed to send email to given address

func SetBlacklist added in v0.16.0

func SetBlacklist(s string)

SetBlacklist can be used to change email blacklist during runtime

func SetWhitelist added in v0.10.0

func SetWhitelist(s string)

SetWhitelist can be used to change email whitelist during runtime

Types

type Context added in v0.15.0

type Context interface {
	Tenant() *models.Tenant
	BaseURL() string
	LogoURL() string
}

Context holds everything emailers need to know about execution context

type Message added in v0.10.0

type Message struct {
	Subject string
	Body    string
}

Message represents what is sent by email

func RenderMessage added in v0.10.0

func RenderMessage(ctx Context, templateName string, params Params) *Message

RenderMessage returns the HTML of an email based on template and params

type Params added in v0.10.0

type Params map[string]interface{}

Params used to replace variables on emails

func (Params) Merge added in v0.10.0

func (p Params) Merge(p2 Params) Params

Merge given params into current params

type Recipient added in v0.10.0

type Recipient struct {
	Name    string
	Address string
	Params  Params
}

Recipient contains details of who is receiving the email

func NewRecipient added in v0.10.0

func NewRecipient(name, address string, params Params) Recipient

NewRecipient creates a new Recipient

func (Recipient) String added in v0.16.0

func (r Recipient) String() string

Strings returns the RFC format to send emails via SMTP

type Sender

type Sender interface {
	Send(ctx Context, templateName string, params Params, from string, to Recipient) error
	BatchSend(ctx Context, templateName string, params Params, from string, to []Recipient) error
}

Sender is used to send emails

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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