Documentation
¶
Overview ¶
Package email is the platform's one email-sending capability: a narrow Sender interface plus SMTP, SES, and Resend implementations, shared by internal/alerting and internal/api so neither imports the other.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotConfigured = errors.New("email: not configured")
ErrNotConfigured is returned by NewSender when a Config names no backend: no settings row and no env-var fallback.
Functions ¶
func ValidateAddress ¶ added in v0.2.0
ValidateAddress reports an error unless s is a single bare email address ("a@b.com", not "Name <a@b.com>" or a list).
Types ¶
type Config ¶
type Config struct {
Backend Backend
SMTP *SMTPConfig
SES *SESConfig
Resend *ResendConfig
}
Config names which backend to use plus that backend's own settings.
type ConfigLoader ¶
ConfigLoader resolves the current Config on every call, never cached: settings can change at runtime.
type DynamicSender ¶
type DynamicSender struct {
// contains filtered or unexported fields
}
DynamicSender adapts a ConfigLoader into a Sender, so a settings change takes effect on the very next send with no restart required.
func NewDynamicSender ¶
func NewDynamicSender(load ConfigLoader) *DynamicSender
NewDynamicSender builds a DynamicSender. load must not be nil.
func (*DynamicSender) Configured ¶
func (d *DynamicSender) Configured(ctx context.Context) bool
Configured reports whether the current settings name a backend that can send, so callers can tell "no mail server set up" from a failed send.
type ResendConfig ¶ added in v0.2.0
ResendConfig is a Resend sender's connection details.