Resend
hono-email/resend provides ResendAdapter for the Resend Email API. The adapter calls Resend directly with fetch; the official Resend SDK is not required.
Example
Section titled “Example”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.
User-Agent
Section titled “User-Agent”Resend requires a User-Agent header for direct HTTP requests, so ResendAdapter sends one by default. You can override it with the userAgent option.
Shared adapter features
Section titled “Shared adapter features”Like all provider adapters, Resend supports to, cc, bcc, replyTo, custom headers, and attachments. Inline attachments use cid when the provider supports content IDs.
Options
Section titled “Options”apiKey Required
Section titled “apiKey ”Type: string
Your Resend API key.
apiBaseUrl Optional
Section titled “apiBaseUrl ”Type: string · Default: 'https://api.resend.com'
Override the Resend API base URL.
fetch Optional
Section titled “fetch ”Type: (input: string, init: RequestInit) => Promise<Response>
Custom fetch implementation. Defaults to globalThis.fetch.
userAgent Optional
Section titled “userAgent ”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.