Skip to content

hono-email/aws-ses provides SesAdapter for Amazon SES. The adapter uses AWS SDK v3 to handle credentials, request signing, and delivery.

Install the SDK only in applications that use SES:

Terminal window
npm i hono-email hono @aws-sdk/client-sesv2

The SDK is an optional peer dependency and is not bundled into hono-email.

import { SESv2Client } from '@aws-sdk/client-sesv2'
import { Body, Html, Text } from 'hono-email'
import { SesAdapter, sendEmail } from 'hono-email/aws-ses'
const client = new SESv2Client({ region: 'ap-northeast-1' })
const receipt = await sendEmail({
adapter: SesAdapter({ client }),
from: { address: 'sender@example.com', name: 'Sender' },
to: ['recipient@example.com'],
subject: 'Welcome',
jsx: (
<Html>
<Body>
<Text>Hello from AWS SES.</Text>
</Body>
</Html>
),
})
if (!receipt.successful) {
console.error(receipt.errorMessages)
}

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

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

Type: SesClient

An AWS SDK v3 SESv2Client. Configure region, credentials, timeouts, and retries on this client.

configurationSetName Optional

Section titled “configurationSetName ”

Type: string

Default SES configuration set.

Type: Readonly<Record<string, string>>

Default SES event tags.

limits.maxAttachmentSize Optional

Section titled “limits.maxAttachmentSize ”

Type: number

Maximum attachment size in bytes.