Documentation
¶
Overview ¶
Package email provides an interface for plugins and application code to send email. [Gomail](gopkg.in/gomail.v2) is used with SMTP as the default.
SMTP can be configured using global configuration, either as ENV or from a configuration file.
|-------------------------|---------------------| | Env | JSON | | ------------------------|---------------------| | PF__EMAIL__FROM | email.from | | PF__EMAIL__SMTP__HOST | email.smtp.host | | PF__EMAIL__SMTP__PORT | email.smtp.port | | PF__EMAIL__SMTP__USER | email.smtp.username | | PF__EMAIL__SMTP__PASS | email.smtp.password | |-------------------------|---------------------|
Index ¶
Constants ¶
const PluginName = "email"
Constant name for identifying the email plugin.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmailOption ¶
type EmailOption func(*EmailPlugin)
EmailOptions customize the configuration of the email plugin.
func WithFrom ¶
func WithFrom(from string) EmailOption
WithFrom configures the default from address.
func WithSMTP ¶
func WithSMTP(host string, port int, username, password string) EmailOption
WithSMTP configures the SMTP server to use.
func WithSender ¶ added in v0.3.0
func WithSender(sender Sender) EmailOption
WithSender configures a custom Sender implementation. This is primarily useful for testing, allowing you to inject a mock sender.
type EmailPlugin ¶
type EmailPlugin struct {
// contains filtered or unexported fields
}
EmailPlugin exposes the ability to send emails.
func (*EmailPlugin) Send ¶
Send an email. TODO: Switch to daemon mode per example here: https://pkg.go.dev/gopkg.in/gomail.v2#example-package-Daemon