mailer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2018 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AppName      string
	Domain       string
	Driver       string
	Options      map[string]string
	Storer       Storer
	TokenCreator TokenCreator
	TemplateDir  string
}

Config Generic Mail Controller Configuration

type MailController

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

MailController Mail controller instance

func NewMailController

func NewMailController(appName, domain, driver string, options map[string]string, storer Storer, tokenCreator TokenCreator, templateDir string) (*MailController, error)

NewMailController Creates a mail controller

func (*MailController) HandleEvent

func (mc *MailController) HandleEvent(e interface{}) error

HandleEvent processes events sent to the mailer process.

func (*MailController) SendActivation

func (mc *MailController) SendActivation(email string, data map[string]string) error

SendActivation Send a activation email to the provided address

func (*MailController) SendMail

func (mc *MailController) SendMail(address, subject, body string) error

SendMail Send a message to the provided email address

func (*MailController) SendPasswordChanged

func (mc *MailController) SendPasswordChanged(email string, data map[string]string) error

SendPasswordChanged Send a password changed email to the provided address

func (*MailController) SendPasswordReset

func (mc *MailController) SendPasswordReset(email string, data map[string]string) error

SendPasswordReset Send a password reset email to the provided address

func (*MailController) SendTemplate

func (mc *MailController) SendTemplate(template, address, subject string, data map[string]string) error

SendTemplate fills and sends a template based email

func (*MailController) SendUnlock

func (mc *MailController) SendUnlock(email string, data map[string]string) error

SendUnlock Send a activation email to the provided address

type MailDriver

type MailDriver interface {
	Send(to, subject, body string) error
}

MailDriver defines the interface that must be implemented by a concrete mailer driver

type Storer

type Storer interface {
	GetUserByExtID(extID string) (interface{}, error)
}

Storer required by mailer

type TokenCreator

type TokenCreator interface {
	BuildToken(userID string, action api.TokenAction, duration time.Duration) (string, error)
}

TokenCreator generates action tokens for inclusion in emails

type User

type User interface {
	GetExtID() string
	GetUsername() string
	GetEmail() string
}

User objects returned by storer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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