Skip to content

hono-email/resend provides ResendAdapter for the Resend Email API. The adapter calls Resend directly with fetch; the official Resend SDK is not required.

import { Body, Html, Text, sendEmail } from 'hono-email'
import ResendAdapter from 'hono-email/resend'
const receipt = await sendEmail({
adapter: ResendAdapter({
apiKey: process.env.RESEND_API_KEY!,
}),
from: 'Sender <sender@example.com>',
to: ['recipient@example.com'],
subject: 'Welcome',
jsx: (
<Html>
<Body>
<Text>Hello from Resend.</Text>
</Body>
</Html>
),
attachments: [
{
filename: 'invoice.txt',
content: 'Invoice text',
contentType: 'text/plain',
},
],
})
if (!receipt.successful) {
console.error(receipt.errorMessages)
}

For the full list of configuration options, see the Resend Options API Reference.

Resend requires a User-Agent header for direct HTTP requests, so ResendAdapter sends one by default. You can override it with the userAgent option.

Like all provider adapters, Resend supports to, cc, bcc, replyTo, custom headers, and attachments. Inline attachments use cid when the provider supports content IDs.

Type: string

Your Resend API key.

Type: string · Default: 'https://api.resend.com'

Override the Resend API base URL.

Type: (input: string, init: RequestInit) => Promise<Response>

Custom fetch implementation. Defaults to globalThis.fetch.

Type: string · Default: 'hono-email'

User-Agent header sent with each request.

limits.maxAttachmentSize Optional

Section titled “limits.maxAttachmentSize ”

Type: number

Maximum attachment size in bytes.