Send transactional email
Validate the message before delivery and interpret the provider's result conservatively.
Construct an application-owned message
Create the service from a selected adapter. Use stable application IDs when a message is associated with a durable transaction.
import { createEmailService, type EmailAdapter } from "@smoothie-framework/email";
export async function sendWelcome(adapter: EmailAdapter) {
const email = createEmailService(adapter);
return email.send({
id: crypto.randomUUID(),
from: "workspace@example.com",
to: "user@example.com",
subject: "Welcome",
text: "Your workspace is ready.",
});
}Keep content and retry policy explicit
The current API supports one ASCII mailbox recipient and bounded text/HTML, with at most 64 KiB combined. Attachments, CC/BCC, custom headers and remote body loading are not included.
HTML must be trusted application-authored content; escape user data in templates. A provider-accepted result is not inbox confirmation. Store durable delivery intent and choose retry/expiry policy outside this service.