mailer

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine provides the capability to parse/render email template and send it out via SMTP protocol.

func NewEngine

func NewEngine(asset *support.Asset, config *support.Config, i18n *support.I18n, logger *support.Logger, viewFuncs map[string]interface{}) *Engine

NewEngine initializes the engine instance to manage email template and sending.

func (*Engine) AddPreview

func (e *Engine) AddPreview(mail *Mail)

AddPreview add the mail HTML/text template preview.

func (*Engine) ComposeEmail

func (e *Engine) ComposeEmail(mail *Mail) (*email.Email, error)

ComposeEmail constructs the HTML/text content and transforms mailer.Mail into email.Email.

func (*Engine) Deliver

func (e *Engine) Deliver(mail *Mail) error

Deliver sends the email via SMTP protocol without TLS.

func (*Engine) Deliveries

func (e *Engine) Deliveries() []*Mail

Deliveries returns the Mail array which is used for unit test with APPY_ENV=test.

func (*Engine) Previews

func (e *Engine) Previews() map[string]*Mail

Previews returns all the templates preview.

type Mail

type Mail struct {
	From, Sender, Subject, Template, Locale, HTML, Text string
	To, ReplyTo, Bcc, Cc, Attachments, ReadReceipt      []string
	Headers                                             textproto.MIMEHeader
	TemplateData                                        interface{}
}

Mail defines the email headers/body/attachments.

Jump to

Keyboard shortcuts

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