Documentation
¶
Index ¶
Constants ¶
View Source
const (
PluginName = "mailer"
)
Variables ¶
This section is empty.
Functions ¶
func PseudorandomString ¶
Types ¶
type AddressConfig ¶
type Configurer ¶
type Mailer ¶
type Mailer interface {
// Send sends an email with the provided Message.
Send(message *Message) error
}
Mailer defines a base mail client interface.
type Message ¶
type Message struct {
From mail.Address
To []mail.Address
Bcc []mail.Address
Cc []mail.Address
Subject string
HTML string
Text string
Headers map[string]string
Attachments map[string]io.Reader
}
Message defines a generic email message struct.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func (*Plugin) Init ¶
func (p *Plugin) Init(cfg Configurer) error
type SendMail ¶
type SendMail struct {
CmdPath string `mapstructure:"cmd_path" json:"cmd_path,omitempty" bson:"cmd_path,omitempty"` // sendmail cmd path
}
SendMail implements mailer.Mailer interface and defines a mail client that sends emails via the "sendmail" *nix command.
This client is usually recommended only for development and testing.
type SmtpClient ¶
type SmtpClient struct {
Host string `mapstructure:"host" json:"host,omitempty" bson:"host,omitempty"`
Port int `mapstructure:"port" json:"port,omitempty" bson:"port,omitempty"`
Username string `mapstructure:"username" json:"username,omitempty" bson:"username,omitempty"`
Password string `mapstructure:"password" json:"password,omitempty" bson:"password,omitempty"`
Tls bool `mapstructure:"tls" json:"tls,omitempty" bson:"tls,omitempty"`
AuthMethod SmtpAuth `mapstructure:"auth" json:"auth_method,omitempty" bson:"auth_method,omitempty"` // default to "PLAIN"
From AddressConfig `mapstructure:"from" json:"from,omitempty" bson:"from,omitempty"`
}
SmtpClient defines a SMTP mail client structure that implements `mailer.Mailer` interface.
func (SmtpClient) Send ¶
func (c SmtpClient) Send(m *Message) error
Send implements `mailer.Mailer` interface.
Click to show internal directories.
Click to hide internal directories.