Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Email ¶
type Email struct {
// contains filtered or unexported fields
}
Email contains the email renderer and the email sender
func NewEmail ¶
func NewEmail(emailRenderer EmailRenderer, mailer Sender) Email
NewEmail constructor
type EmailRenderer ¶
type EmailRenderer struct {
// contains filtered or unexported fields
}
EmailRenderer implements the Renderer interface
func NewEmailRenderer ¶
func NewEmailRenderer( templateRepo templater, toLoad []string, mailFrom string, ) (*EmailRenderer, error)
NewEmailRenderer is mailRenderer's constructor It takes: - a templateRepo that abstract the way we get email NewTemplateFileSystem - a template to preload list - parameters about how to build emails...
func (*EmailRenderer) NewEmail ¶
func (m *EmailRenderer) NewEmail( ctx context.Context, to string, subject string, templateName string, data map[string]interface{}, ) (*Notification, error)
NewEmail return an new email structure filled with all necessary information to be sent. data must be a map[string]interface{} corresponding to template indicated by the templateN ame string.
type MailerAmazonSES ¶
type MailerAmazonSES struct {
// contains filtered or unexported fields
}
MailerAmazonSES contains configuration for the amazon mail service
func NewMailerAmazonSES ¶
func NewMailerAmazonSES(region string, configurationSet string) *MailerAmazonSES
NewMailerAmazonSES is MailerAmazonSES's constructor
func (*MailerAmazonSES) Send ¶
func (m *MailerAmazonSES) Send(ctx context.Context, email *Notification) error
Send uses amazon ses sdk to send an email
type MailerLogger ¶
type MailerLogger struct { }
MailerLogger logs emails instead of sending them.
func NewLogMailer ¶
func NewLogMailer() *MailerLogger
NewLogMailer creates a mailer that doesn't deliver emails but simply logs them.
func (MailerLogger) Send ¶
func (l MailerLogger) Send(ctx context.Context, email *Notification) error
Send an email (log only text)
type Notification ¶
Notification content and configuration
type Renderer ¶
type Renderer interface {
NewEmail(ctx context.Context, to string, subject string, templateName string, data map[string]interface{}) (*Notification, error)
}
Renderer is a set of functions to create a new email from a template
type Sender ¶
type Sender interface {
Send(ctx context.Context, email *Notification) error
}
Sender is a set of functions to manage the email sending
type TemplateFileSystem ¶
type TemplateFileSystem struct {
// contains filtered or unexported fields
}
TemplateFileSystem is load and serve templates from local file system
func NewTemplateFileSystem ¶
func NewTemplateFileSystem(location string) *TemplateFileSystem
NewTemplateFileSystem ...
func (*TemplateFileSystem) Get ¶
func (t *TemplateFileSystem) Get(name string) (*template.Template, error)
Get return previously loaded templates
func (*TemplateFileSystem) Load ¶
func (t *TemplateFileSystem) Load(name string) error
Load parses and prepare a template for further use of it It will reloads the template if called many times with same input