Resend installation
Install the package
Use Bun first when possible:
bun add @workermailer/resend
If your project uses npm:
npm install @workermailer/resend
Add your API key as a secret
wrangler secret put RESEND_API_KEY
If you want a default sender address available across sends, store that too.
wrangler secret put RESEND_FROM
Minimal Worker config
This package uses fetch, so you do not need the socket-specific setup required by the SMTP package. A normal Worker deployment is enough as long as outbound HTTPS is available.
Recommended environment shape
interface Env {
RESEND_API_KEY: string;
RESEND_FROM?: string;
}
Local development
Because the package uses fetch, local development is simpler than SMTP. You can still choose to stub delivery in dev mode if you do not want to hit the real API.
if (import.meta.env?.DEV) {
console.log('Skipping real Resend send in local development');
return;
}