Skip to content

Email

sendTransactional, resolveMailer, resolveMailerStatus, createMailer, astroidMailTheme, and the templates magicLinkEmail, passwordResetEmail, inquiryNotificationEmail, inquiryConfirmationEmail, sendInquiryMail.

inquiryNotificationEmail gives the owner the whole submission. inquiryConfirmationEmail goes to the address the form submitted, so it quotes nothing the sender wrote: no message and no regarding. It greets the sender by given name only when that name is letters, apostrophes, and hyphens, at most 40 of them, and otherwise greets them as “there”. A confirmation that echoed the message would let anyone send their own text from the site’s address to any inbox.

astroidMailTheme(config, overrides?, context?) derives the theme from theme.colors. The overrides take any MailTheme field: palette, fonts, and brand merge key by key, and the rest, such as masthead, logo, shadow, and buttonAlign, pass through. A logo.src that’s a path, such as /brand/logo-mail.png, resolves against context.siteUrl, so pass { siteUrl: env.SITE_URL } when you build the theme for a send. Without a siteUrl, the masthead draws the wordmark. sendInquiryMail reads env.SITE_URL itself.

Always build options with resolveMailer(env) rather than by hand—it’s the only thing that applies the placeholder-sentinel check, so a hand-built options object can call the Email API with an envelope sender of literally DUMMY_REPLACE_ME.

When a send is skipped the message is logged, but the body is withheld unless the environment reads as development—it carries single-use sign-in and reset links, and logOnly engages in production whenever MAIL_FROM is unset. Pass devLog: true to force it (for example, under bare wrangler dev).