Documentation
¶
Overview ¶
Package email sends notification batches over implicit-TLS SMTP.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidConfig indicates invalid transport or destination settings. ErrInvalidConfig = errors.New("invalid email configuration") // ErrInvalidAddress indicates an invalid envelope address. ErrInvalidAddress = errors.New("invalid email address") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Host string
Port string
Username string
Password string
From string
TLSServerName string
// TLSConfig overrides the default TLS configuration (TLS 1.2 minimum). NewTransport clones it.
TLSConfig *tls.Config
// MaxIdleConnections caps SMTP connections kept open for reuse between sends,
// avoiding a full TCP+TLS+AUTH handshake on every batch. Defaults to 4.
MaxIdleConnections int
}
Config defines SMTP settings. All fields except TLSServerName, TLSConfig, and MaxIdleConnections are required; From does not default to Username.
type Transport ¶
type Transport[T any] struct { // contains filtered or unexported fields }
Transport is an immutable SMTP client shared safely by concurrent destinations. It keeps a small pool of authenticated connections open between sends.
func NewTransport ¶
NewTransport validates cfg and creates a Transport without network I/O.
func (*Transport[T]) Close ¶ added in v0.3.0
Close closes every idle pooled connection and stops future pooling. Connections currently in use finish normally and are closed rather than pooled when they're returned. The Transport remains usable afterward; it just dials a fresh connection for every send from now on.
func (*Transport[T]) Recipient ¶
func (transport *Transport[T]) Recipient( id string, address string, renderer Renderer[T], ) (notifier.Destination[T], error)
Recipient creates a destination for one SMTP recipient.
func (*Transport[T]) RecipientGroup ¶
func (transport *Transport[T]) RecipientGroup( id string, addresses []string, renderer Renderer[T], ) (notifier.Destination[T], error)
RecipientGroup creates a destination that sends to all addresses in one SMTP transaction.