Documentation ¶
Index ¶
Constants ¶
const ( HTMLExtension = "html" TextExtension = "txt" YAMLExtension = "yaml" ExampleFileSuffix = "example" // i.e. file.example.yaml )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Files ¶
func FilesFromLocalDir ¶
func FilesFromRiceBox ¶
func SimpleTemplate ¶
func SimpleTemplate() Files
Simple is a simple default template ready to be used. See https://github.com/leemunroe/responsive-html-email-template
type Mail ¶
type Mail struct {
FromName, FromAddress string
ToName, ToAddress string
Subject string
HTML, Text []byte
// contains filtered or unexported fields
}
func (*Mail) Template ¶
Template sets the template to be used for this email. Make sure to call mail.Render() afterwards. If both name.html and name.txt are available, both will be included in mail. If only name.html or name.txt are available, the one available will be used. If neither name.html nor name.txt are available, an error is returned when Rendered.
type MissingVar ¶
type MissingVar int
const ( HaltOnError MissingVar = iota ContinueOnError ZeroValueOnError )
type Provider ¶
type Provider interface { // Send sends a mail. The implementing provider must call // Mail.Render() before accessing Mail.HTML or Mail.Text. Send(*Mail) error }
Provider interface just exists to lousily enforce some consistency across mail providers. Mail only works for basic emails.
type RenderOption ¶
type RenderOption func(*Templates)
func AddFunc ¶
func AddFunc(name string, fn interface{}) RenderOption
Func adds a function to the template's function map.
func AddFuncs ¶
func AddFuncs(funcMap map[string]interface{}) RenderOption
Funcs adds the elements of the argument map to the template's function map.
func DisableInlineCSS ¶
func DisableInlineCSS() RenderOption
func OnMissingVar ¶
func OnMissingVar(mode MissingVar) RenderOption
type Templates ¶
type Templates struct {
// contains filtered or unexported fields
}
func NewTemplates ¶
func NewTemplates(files Files, opts ...RenderOption) (*Templates, error)