Documentation
¶
Overview ¶
Package email sends reminders by email over SMTP (ADR 0007). It is a notify-only channel: the message carries the reminder and one button that opens the subscription in the web.
It uses the standard library (net/smtp, crypto/tls): one message per reminder to one recipient needs nothing more.
Index ¶
Constants ¶
View Source
const ( TLSStartTLS = "starttls" // plain connection upgraded with STARTTLS (port 587) TLSImplicit = "tls" // TLS from the first byte (port 465) TLSNone = "none" // no encryption: local relays only )
TLS modes.
View Source
const Name = "email"
Name is the channel name in channel_links.
Variables ¶
View Source
var ErrNotConfigured = errors.New("email is not set up")
ErrNotConfigured is returned while the owner has not set up SMTP.
Functions ¶
func Address ¶
Address validates an address a member typed and returns it in the form accounts use: bare (no display name) and lower case.
Types ¶
type Channel ¶
type Channel struct {
notify.OneWay
// Config returns the current SMTP settings; ok is false while email is
// not set up. It is read for every message, so a change applies at once.
Config func(ctx context.Context) (cfg Config, ok bool)
// PublicURL is the instance's public address ("" if unknown).
PublicURL string
}
Channel is the email channel. Its chat id is the recipient's address.
type Config ¶
type Config struct {
Host string `json:"host"`
Port int `json:"port"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
// From is the sender: "reminders@example.com" or "Exhale <reminders@example.com>".
From string `json:"from"`
TLS string `json:"tls"`
// RootCAs replaces the system certificates (tests).
RootCAs *x509.CertPool `json:"-"`
}
Config is how to reach the SMTP server.
Click to show internal directories.
Click to hide internal directories.