Documentation
¶
Overview ¶
Package smtp is the email notify adapter (R-232, R-374, issue #50).
It reaches people: each notification goes to the email address of every account it names, so Pando's own notifications reach someone who is not looking at the console — which is what R-266 was waiting for. Any SMTP server will do, SendGrid's, Mailgun's and Amazon SES's relays included.
Index ¶
- Constants
- func DefaultPort(security string) int
- func Info() api.KindInfo
- func Message(from *mail.Address, to string, n api.Notification, now time.Time) []byte
- type Adapter
- func (a *Adapter) Capabilities() api.NotifyCapabilities
- func (a *Adapter) Category() api.Category
- func (a *Adapter) Configure(_ context.Context, raw json.RawMessage) error
- func (a *Adapter) HealthCheck(ctx context.Context) error
- func (a *Adapter) Kind() string
- func (a *Adapter) Notify(ctx context.Context, n api.Notification) error
- type Config
- type Credentials
Constants ¶
const ( SecurityStartTLS = "starttls" SecurityTLS = "tls" SecurityNone = "none" )
Security is how the connection is protected.
const Kind = "smtp"
Kind is the adapter's kind string.
Variables ¶
This section is empty.
Functions ¶
func DefaultPort ¶ added in v0.10.0
DefaultPort is the port used when none is set: 465 for TLS, which is encrypted from the first byte, and 587 otherwise.
Types ¶
type Adapter ¶
type Adapter struct {
notifykit.Unconnected
// contains filtered or unexported fields
}
Adapter sends email.
func (*Adapter) Capabilities ¶
func (a *Adapter) Capabilities() api.NotifyCapabilities
Capabilities: email reaches the people a notification names.
func (*Adapter) HealthCheck ¶
HealthCheck connects, signs in and says goodbye, sending nothing.
type Config ¶
type Config struct {
Credentials Credentials `json:"credentials,omitzero"`
Host string `json:"host,omitempty"`
Port int `json:"port,omitempty"`
Username string `json:"username,omitempty"`
From string `json:"from,omitempty"`
Security string `json:"security,omitempty"`
TimeoutSeconds int `json:"timeout_seconds,omitempty"`
}
Config is the adapter's configuration.
type Credentials ¶
Credentials is what this adapter keeps secret.