mailers

package
v0.0.0-...-fa3d426 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2016 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetTemplatesDir

func SetTemplatesDir(dir string)

SetTemplatesDir sets the mail templates directory

Types

type BaseMailer

type BaseMailer struct {
	T core.TranslateFunc

	// Template variables
	I18n                   map[string]string
	ServiceName            string
	ServiceUrl             string
	ServicePostalAddress   string
	ServiceCopyrightNotice string
	// contains filtered or unexported fields
}

BaseMailer is a base for all mailers

func NewBaseMailer

func NewBaseMailer(kind string, user *models.User) *BaseMailer

NewBaseMailer instanciates a new BaseMailer

func (*BaseMailer) Kind

func (mailer *BaseMailer) Kind() string

Kind is part of Mailer interface

type Mailer

type Mailer interface {
	Kind() string
	To() string
	Subject() string
}

Mailer is the interface to all mailers

type SMTPConf

type SMTPConf struct {
	From string
	Host string
	Port int
	User string
	Pass string
}

SMTPConf holds SMTP configuration

type Sender

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

Sender send mail via SMTP

func NewSender

func NewSender(mailer Mailer) *Sender

NewSender instanciates a new Sender

func (*Sender) Send

func (sender *Sender) Send() error

Send triggers mail sending

func (*Sender) SetNoop

func (sender *Sender) SetNoop(isNoop bool)

SetNoop sets sender in NOOP mode

func (*Sender) SetSMTPConf

func (sender *Sender) SetSMTPConf(conf *SMTPConf)

SetSMTPConf sets the SMTP configuration

type SignupMailer

type SignupMailer struct {
	*BaseMailer

	// Template variables
	Email         string
	ActivationUrl string
}

SignupMailer implements the signup mailer

func NewSignupMailer

func NewSignupMailer(user *models.User) *SignupMailer

NewSignupMailer instanciates a new SignupMailer

func (*SignupMailer) Send

func (mailer *SignupMailer) Send() error

Send triggers mail sending

func (*SignupMailer) Subject

func (mailer *SignupMailer) Subject() string

Subject is part of Mailer interface

func (*SignupMailer) To

func (mailer *SignupMailer) To() string

To is part of Mailer interface

type Templater

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

Templater handles mail templating

func (*Templater) Generate

func (tpl *Templater) Generate(name string, kind TplKind, mailer Mailer) (string, error)

Generate generates a mail template

type TplKind

type TplKind string

TplKind represents a mail template kind

Jump to

Keyboard shortcuts

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