mailme

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: MIT Imports: 12 Imported by: 8

README

MailMe - send templated mails

MailMe is meant to deliver transaction mails with a template that can be loaded from a URL. If no template is present from the URL it will fall back to a default template.

This makes it easy to deploy your mail templates to a CDN (with Netlify) and have an easy workflow to work with the mails and preview them directly in the browser.

Documentation

Index

Constants

View Source
const TemplateExpiration = 10 * time.Second

TemplateExpiration is the time period that the template will be cached for

View Source
const TemplateRetries = 3

TemplateRetries is the amount of time MailMe will try to fetch a URL before giving up

Variables

This section is empty.

Functions

This section is empty.

Types

type MailTemplate

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

type Mailer

type Mailer struct {
	From    string
	Host    string
	Port    int
	User    string
	Pass    string
	BaseURL string
	FuncMap template.FuncMap

	Logger logrus.FieldLogger
	// contains filtered or unexported fields
}

Mailer lets MailMe send templated mails

func (*Mailer) Mail

func (m *Mailer) Mail(to, subjectTemplate, templateURL, defaultTemplate string, templateData map[string]interface{}) error

Mail sends a templated mail. It will try to load the template from a URL, and otherwise fall back to the default

func (*Mailer) MailBody

func (m *Mailer) MailBody(url string, defaultTemplate string, data map[string]interface{}) (string, error)

type TemplateCache

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

func (*TemplateCache) Get

func (t *TemplateCache) Get(url string) (*template.Template, error)

func (*TemplateCache) Set

func (t *TemplateCache) Set(key, value string, expirationTime time.Duration) (*template.Template, error)

Jump to

Keyboard shortcuts

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