Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComposeSMTPMsg ¶
ComposeSMTPMsg builds the content to be sent through an SMTP server
Types ¶
type ConsoleMailer ¶
type ConsoleMailer struct{}
ConsoleMailer implements the Mailer interface to print summaries of emails insted of actually send them.
func NewConsoleMailer ¶
func NewConsoleMailer() *ConsoleMailer
NewConsoleMailer returns a new Mailer that prints emails instead of sending a real email
func (*ConsoleMailer) Send ¶
func (m *ConsoleMailer) Send(e Email) error
Send prints the email to, from and subject fields to console
func (*ConsoleMailer) Sender ¶
func (m *ConsoleMailer) Sender() (string, string)
type LoggerMailer ¶
type LoggerMailer struct {
// contains filtered or unexported fields
}
LoggerMailer implements a Mailer interface, wrapping another Mailer, and adding log information to the Send method
func NewLoggerMailer ¶
func NewLoggerMailer(wrapped Mailer, ins *obs.Insighter) *LoggerMailer
NewLoggerMailer wraps a given mailer to add logging information
func (*LoggerMailer) Send ¶
func (m *LoggerMailer) Send(e Email) error
Send sends an email through the wrapped mailer and logs information about the email being sent
func (*LoggerMailer) Sender ¶
func (m *LoggerMailer) Sender() (string, string)
Sender proxies the call to the underlying mailer
type Mailer ¶
type Mailer interface { // Send sends an email. Depending on the implementation // might require that the e.From.Address matches the one // returned from the Sender call. Send(e Email) error // Sender returns the address and name of the default // sender for this maile Sender() (string, string) }
Mailer is the general interface for sending emails
func NewMailtrapMailer ¶
func NewMailtrapMailer(conf MailtrapConfig) (Mailer, error)
NewMailtrapMailer instantiates a new Mailtrap mailer.
func NewSMTPMailer ¶
func NewSMTPMailer(conf SMTPConfig) (Mailer, error)
NewSMTPMailer instantiates a new SMTP mailer.
type MailgunMailer ¶
type MailgunMailer struct {
// contains filtered or unexported fields
}
MailgunMailer implements the Mailer interface to send emails using Mailgun service
func NewMailgunMailer ¶
func NewMailgunMailer(domain string, key string, senderEmail string, senderName string, useEUServer bool) (*MailgunMailer, error)
NewMailgunMailer creates a new Mailer to send emails through Mailgun
func (*MailgunMailer) Send ¶
func (m *MailgunMailer) Send(e Email) error
Send sends an email through Mailgun
func (*MailgunMailer) Sender ¶
func (m *MailgunMailer) Sender() (string, string)
Sender returns the default sender address and name
type MailtrapConfig ¶
MailtrapConfig has the configurations to use the Mailtrap service
type MockMailer ¶
type MockMailer struct {
SentMails []Email
}
MockMailer implements the Mailer interface, saving emails to be sent in memory (SentMails) instead of actually sending them
func NewMockMailer ¶
func NewMockMailer() *MockMailer
NewMockMailer creates a mailre that stores in memory all sent emails WARNING: Not for production!! Use only for tests
func (*MockMailer) Send ¶
func (m *MockMailer) Send(e Email) error
Send stores the email to be sent in the SentMails field
func (*MockMailer) Sender ¶
func (m *MockMailer) Sender() (string, string)
Sender returns the default sender address and name
type NopMailer ¶
type NopMailer struct{}
NopMailer implements the Mailer interface, but does nothing when Send is called
func NewNopMailer ¶
func NewNopMailer() *NopMailer
NewNopMailer returns a Mailer that does absolutely nothing
type RoundcubeMailer ¶
RoundcubeMailer is an SMTP server for local dev-env environments.
func NewRoundcubeMailer ¶
func NewRoundcubeMailer() *RoundcubeMailer
NewRoundcubeMailer instantiates a new Roundcube mailer.
func (*RoundcubeMailer) Send ¶
func (m *RoundcubeMailer) Send(e Email) error
Send sends an email to Roundcube service.
func (*RoundcubeMailer) Sender ¶
func (m *RoundcubeMailer) Sender() (string, string)
Sender returns the default sender address and name
type SMTPConfig ¶
type SMTPConfig struct { Host string Port int User string Password string SenderName string SenderAddress string }
SMTPConfig has the configurations to use the SMTP service
type SendGridMailer ¶
type SendGridMailer struct {
// contains filtered or unexported fields
}
SendGridMailer implements the Mailer interface to send emails using SendGrid service
func NewSendGridMailer ¶
func NewSendGridMailer(key, fromAddress, fromName string) (*SendGridMailer, error)
NewSendGridMailer creates a new Mailer to send emails through SendGrid
func (*SendGridMailer) Send ¶
func (m *SendGridMailer) Send(e Email) error
Send sends an email through SendGrid
func (*SendGridMailer) Sender ¶
func (m *SendGridMailer) Sender() (string, string)