Adapter Options
Each delivery adapter has specific configuration options passed when initializing the transport or adapter function.
SMTP Options
Section titled “SMTP Options”SMTP settings used with SmtpTransport.
SmtpTransportOptions
Section titled “SmtpTransportOptions”type SmtpTransportOptions = { connector: SmtpConnector hostname: string port: number secure?: boolean | 'starttls' auth?: SmtpAuth dkim?: EmailDkimOptions clientName?: string connectionTimeout?: number greetingTimeout?: number socketTimeout?: number limits?: EmailAttachmentLimits pool?: { maxConnections?: number maxMessages?: number }}connector Required
Section titled “connector ”Type: SmtpConnector
Runtime-specific socket connector. Built-in connectors are available for different runtimes (e.g. nodeSmtpConnector for Node.js, cloudflareSmtpConnector for Cloudflare Workers).
hostname Required
Section titled “hostname ”Type: string
SMTP server host name (e.g., 'smtp.gmail.com').
port Required
Section titled “port ”Type: number
SMTP server port (e.g., 587 or 465).
secure Optional
Section titled “secure ”Type: boolean | 'starttls'
TLS mode. true uses implicit TLS (usually on port 465), 'starttls' upgrades the connection using STARTTLS after the initial handshake (usually on port 587).
auth Optional
Section titled “auth ”Type: SmtpAuth
Authentication configuration. See SmtpAuth.
dkim Optional
Section titled “dkim ”Type: EmailDkimOptions
Default DKIM signing options for all outgoing messages on this transport. See EmailDkimOptions.
clientName Optional
Section titled “clientName ”Type: string · Default: 'localhost'
Name sent during the SMTP EHLO/HELO handshake.
connectionTimeout Optional
Section titled “connectionTimeout ”Type: number
Connection timeout in milliseconds.
greetingTimeout Optional
Section titled “greetingTimeout ”Type: number
Greeting timeout in milliseconds.
socketTimeout Optional
Section titled “socketTimeout ”Type: number
Socket idle timeout in milliseconds.
limits Optional
Section titled “limits ”Type: EmailAttachmentLimits
Attachment size limits.
pool Optional
Section titled “pool ”maxConnections: Maximum number of concurrent connections in the pool (Default:1).maxMessages: Maximum number of messages to send over a single connection before retiring it.
SmtpAuth
Section titled “SmtpAuth”type SmtpAuth = | { type?: 'plain' username: string password: string } | { type: 'login' username: string password: string }type: Mechanism used for SMTP authentication ('plain'or'login').username: Username credential.password: Password credential.
SMTP Connector Interfaces
Section titled “SMTP Connector Interfaces”When using SmtpTransport, the runtime-specific socket creation is handled by a connector.
SmtpConnector
Section titled “SmtpConnector”type SmtpConnector = { connect( address: SmtpSocketAddress, options: SmtpConnectorOptions, ): SmtpSocket | Promise<SmtpSocket>}SmtpSocketAddress: An object containing{ hostname: string, port: number }.SmtpConnectorOptions: Contains{ secureTransport: 'off' | 'on' | 'starttls' }.
SmtpSocket
Section titled “SmtpSocket”An abstraction layer for the underlying TCP connection:
type SmtpSocket = { readable: ReadableStream<Uint8Array> writable: WritableStream<Uint8Array> opened?: Promise<unknown> closed?: Promise<void> startTls?: () => SmtpSocket | Promise<SmtpSocket> close?: () => Promise<void> | void}Resend Options
Section titled “Resend Options”Options passed to ResendAdapter.
ResendAdapterOptions
Section titled “ResendAdapterOptions”type ResendAdapterOptions = { apiKey: string apiBaseUrl?: string fetch?: ResendFetch limits?: EmailAttachmentLimits userAgent?: string}apiKey Required
Section titled “apiKey ”Type: string
Resend API Key.
apiBaseUrl Optional
Section titled “apiBaseUrl ”Type: string · Default: 'https://api.resend.com'
Custom API base URL override.
fetch Optional
Section titled “fetch ”Type: ResendFetch
Custom fetch implementation. If omitted, uses the global fetch of the current environment.
limits Optional
Section titled “limits ”Type: EmailAttachmentLimits
Attachment limits.
SendGrid Options
Section titled “SendGrid Options”Options passed to SendGridAdapter.
SendGridAdapterOptions
Section titled “SendGridAdapterOptions”type SendGridAdapterOptions = { apiKey: string apiBaseUrl?: string fetch?: SendGridFetch limits?: EmailAttachmentLimits userAgent?: string}apiKey Required
Section titled “apiKey ”Type: string
SendGrid API Key (Bearer Token).
apiBaseUrl Optional
Section titled “apiBaseUrl ”Type: string · Default: 'https://api.sendgrid.com'
Custom API base URL override.
Postmark Options
Section titled “Postmark Options”Options passed to PostmarkAdapter.
PostmarkAdapterOptions
Section titled “PostmarkAdapterOptions”type PostmarkAdapterOptions = { serverToken: string apiBaseUrl?: string fetch?: PostmarkFetch limits?: EmailAttachmentLimits messageStream?: string tag?: string trackLinks?: 'HtmlAndText' | 'HtmlOnly' | 'None' | 'TextOnly' trackOpens?: boolean userAgent?: string}serverToken Required
Section titled “serverToken ”Type: string
Postmark Server Token.
messageStream Optional
Section titled “messageStream ”Type: string
Specifies the Postmark Message Stream ID to send through (e.g., 'outbound').
tag Optional
Section titled “tag ”Type: string
Default category/tag for emails sent via this adapter.
trackLinks / trackOpens Optional
Section titled “trackLinks / trackOpens ”Enable link tracking or open tracking behavior at the adapter level.
Mailgun Options
Section titled “Mailgun Options”Options passed to MailgunAdapter.
MailgunAdapterOptions
Section titled “MailgunAdapterOptions”type MailgunAdapterOptions = { apiKey: string domain: string apiBaseUrl?: string fetch?: MailgunFetch limits?: EmailAttachmentLimits userAgent?: string}apiKey Required
Section titled “apiKey ”Type: string
Mailgun API key.
domain Required
Section titled “domain ”Type: string
Mailgun verified sending domain (e.g., 'mg.example.com').
apiBaseUrl Optional
Section titled “apiBaseUrl ”Type: string · Default: 'https://api.mailgun.net'
For EU region domains, set this to 'https://api.eu.mailgun.net'.
Cloudflare Email Options
Section titled “Cloudflare Email Options”Options passed to CloudflareEmailAdapter.
CloudflareEmailAdapterOptions
Section titled “CloudflareEmailAdapterOptions”type CloudflareEmailAdapterOptions = { connector: CloudflareEmailConnector limits?: EmailAttachmentLimits}connector Required
Section titled “connector ”Type: CloudflareEmailConnector
Connector targeting the specific Cloudflare infrastructure.
RESTConnector({ accountId, apiToken }): Calls the Cloudflare Email REST API.WorkersConnector({ bindingName }): Sends through a native Cloudflare Workers Email Routing binding (default binding name is'EMAIL').
Cloudflare Email Connector Interfaces
Section titled “Cloudflare Email Connector Interfaces”CloudflareEmailAdapter requires a connector implementing the CloudflareEmailConnector interface.
CloudflareEmailConnector
Section titled “CloudflareEmailConnector”type CloudflareEmailConnector = { send( request: CloudflareEmailConnectorRequest, ): CloudflareEmailConnectorResult | Promise<CloudflareEmailConnectorResult>}CloudflareEmailRestConnectorOptions
Section titled “CloudflareEmailRestConnectorOptions”Options for configuring the RESTConnector:
type CloudflareEmailRestConnectorOptions = { accountId: string apiBaseUrl?: string apiToken: string fetch?: CloudflareEmailFetch}CloudflareEmailWorkersConnectorOptions
Section titled “CloudflareEmailWorkersConnectorOptions”Options for configuring the WorkersConnector:
type CloudflareEmailWorkersConnectorOptions = { bindingName?: string}