import type { DriverFactory } from "../types.mjs"; /** Cloudflare Email Workers outbound binding. Instantiate with the binding * object defined in your \`wrangler.toml\` (\`send_email\` rule): * * ```ts * export default { * async fetch(req, env) { * const email = createEmail({ driver: cloudflareEmail({ binding: env.SEND_EMAIL }) }) * await email.send({ from, to, subject, text }) * } * } * ``` * * The binding accepts a constructed \`EmailMessage\` (see Cloudflare docs — * the SDK exposes \`new EmailMessage(from, to, raw)\` via the global * \`postalmime\` bindings); we build raw RFC 5322 text ourselves. */ export interface CloudflareEmailDriverOptions { binding: CloudflareEmailBinding; /** Optional factory for the \`EmailMessage\` class. Defaults to * \`globalThis.EmailMessage\`, which Workers injects at runtime. */ EmailMessage?: CloudflareEmailMessageCtor; } export interface CloudflareEmailBinding { send: (message: unknown) => Promise | void; } export type CloudflareEmailMessageCtor = new (from: string, to: string, raw: string) => unknown; declare const cloudflareEmail: DriverFactory; export default cloudflareEmail;