Resend API reference
Main exports
import { ResendMailer } from '@workermailer/resend';
import { createQueueHandler, enqueueEmail, enqueueEmails } from '@workermailer/resend/queue';
ResendMailer.connect(options)
Creates a mailer instance configured for the Resend API.
ResendMailerOptions
| Field | Type | Notes |
|---|---|---|
apiKey |
string |
Required Resend API key |
from |
string |
Optional default sender |
baseUrl |
string |
Optional override for the Resend API base URL |
mailer.send(email)
Sends an email through POST /emails on the configured Resend API base URL.
EmailOptions
| Field | Type | Notes |
|---|---|---|
from |
string | User |
Sender identity |
to |
string | string[] | User | User[] |
Required recipients |
reply |
string | User |
Optional reply-to |
cc |
string | string[] | User | User[] |
Carbon copy recipients |
bcc |
string | string[] | User | User[] |
Blind carbon copy recipients |
subject |
string |
Message subject |
text |
string |
Plain text body |
html |
string |
HTML body |
headers |
Record<string, string> |
Custom email headers |
attachments |
Attachment[] |
Attachments sent through the Resend API |
ResendMailer.send(options, email)
Convenience helper for a one-off send without keeping a mailer instance around.
Error behavior
If the API responds with a non-2xx status, the mailer throws an error containing the status code and response body when available.
Queue entry point
The queue module exports:
createQueueHandler()enqueueEmail()enqueueEmails()