Expand description
Mailer capability trait. See plan/ecosystem/02-capabilities.md.
A MailerPlugin sends transactional email. The trait is shaped so
that vendor-specific details never leak: @bext/mailer-smtp
(lettre-backed) and @bext/mailer-ses (AWS SES) both satisfy the
same surface, and a project can swap between them by editing
bext.config.toml without touching code.
§Design notes
- Pre-rendered bodies. Callers hand the mailer a fully rendered
textand/orhtmlbody. Templating lives in the futureTemplatecapability; the mailer is a transport. - Opaque message id.
SendOutcome::idis a vendor-assigned string (SMTPMessage-ID, SESMessageId, …) that callers treat as an opaque correlation handle. The trait makes no promises about its structure. - Batch as a first-class op. SES natively sends many messages
per API call and the cost difference matters. The default
send_batchimpl loops oversendfor transports that don’t batch natively. - Generic error shape.
MailerErrorvariants classify failures in a way both SMTP and API backends can populate. Noses_error_code, nosmtp_reply_code; backends that want to surface their own detail pass it in the variant’sString.
Structs§
- Address
- An RFC 5322 mailbox: an email address plus an optional display name. Both SMTP and SES accept the same shape; neither drives the field layout.
- Attachment
- A single file attached to an outgoing message.
- Message
- A message to send. Pre-rendered: callers supply finished bodies.
- Send
Outcome - Result of a successful send.
Enums§
- Mailer
Error - Why a send failed, classified in a backend-neutral way.
Traits§
- Mailer
Plugin - A plugin that sends transactional email.
Type Aliases§
- Batch
Outcome - Per-message outcome for a batch send: success with an id, or failure with a classified error. The index in the returned vector lines up 1:1 with the index in the input vector, so callers can correlate partial failures.