Expand description
Email delivery abstraction.
Doctrine 6: email is operational infrastructure, not business
logic. Recovery flows compose Mail objects with a fixed
envelope (Mail::framework_envelope) and dispatch them through
a project-supplied Mailer implementation. The framework
refuses to lock into SMTP — projects ship whatever transport
their organisation already uses (SES, Mailgun, Postmark, internal
relay, queued background job, etc.).
§What the framework provides
- The
Mailertrait — one async method,send. LogMailer— the safe default. Writes the would-be email tolog::info!so reset links stay visible during dev / CI without a mail server. Not suitable for production: in production a real mailer must be configured or recovery emails will be silently lost.Mail+Mail::framework_envelopefor canonical headers (timestamp, source IP, browser/OS summary, “if this was not you” guidance) per doctrine 6.
§Project override
ⓘ
let admin = Admin::new()
.mailer(Arc::new(MyProjectMailer::new(/* SES, Mailgun, … */)));The default is LogMailer — projects opt in to a real mailer
by registering one. R1+ recovery flows will read the configured
mailer from Admin and refuse to boot in production mode if
none is registered.
Structs§
- LogMailer
- Default mailer. Writes the message to
log::info!instead of sending it. Safe for dev / CI / testing where outbound SMTP is forbidden or undesirable; not suitable for production — recovery emails will be lost (the audit row will record the attempt). - One outbound message. Plaintext body is required; HTML is optional. Extra headers are project-controlled.
- Recovery
Email Parts - Structured inputs to
render_recovery_html. Kept separate fromMailso the framework’s HTML email surface stays declarative — call-sites pass labelled fields rather than a long positional argument list.
Enums§
- Mailer
Error - Errors a
Mailercan return. The most important variant isMailerError::ConfigurationMissing— the framework treats it as a hard boot failure when production deployments forget to wire up a real mailer (per the user-locked decision: “Mailer blocking behaviour” → refuse to start when no mailer is configured for production).
Traits§
- Mailer
- Async outbound-mail interface. Project implementations live in
the project crate so the framework never imports
lettre/aws-sdk-ses/ etc.
Functions§
- render_
recovery_ html - Render the framework’s polished HTML body for a recovery /
magic-link email. The visual treatment matches DESIGN_CHROME.md:
calm typography, a single brand-accent point of emphasis (the
CTA button), hairline separation, table-based layout for email-
client compatibility, inlined CSS for clients that strip
<style>blocks, and a@mediaquery for mobile readability.
Type Aliases§
- Shared
Mailer - Type-erased shared mailer reference. The framework’s
Adminholds one of these; defaults toArc::new(LogMailer)until a project overrides viaAdmin::mailer(Arc::new(...)).