Amplify Overtone
Email

defineEmail()

Configure transactional email infrastructure for your Amplify backend.

defineEmail()

defineEmail() is a singleton factory that provisions Amazon SES resources — domain identity, named senders, a send-email Lambda function, and optional Route 53 DNS records.

Usage Modes

Without Custom Domain (Simplest)

Each sender provides a full email address that you verify individually in SES:

import { defineEmail } from "@nxsflow/amplify-overtone";

export const email = defineEmail({
    senders: {
        noreply: {
            senderEmail: "noreply@gmail.com",
            displayName: "MyApp",
        },
    },
});

With Custom Domain

Senders provide a prefix. The domain identity handles authentication for all senders:

export const email = defineEmail({
    domain: "mail.example.com",
    senders: {
        noreply: {
            senderPrefix: "noreply",
            displayName: "MyApp",
        },
        support: {
            senderPrefix: "support",
            displayName: "MyApp Support",
        },
    },
});

With Route 53 DNS Automation

Provide your hosted zone to auto-create MX, CNAME, and TXT records:

export const email = defineEmail({
    domain: "mail.example.com",
    hostedZoneId: "Z0123456789ABCDEFGHIJ",
    hostedZoneDomain: "example.com",
    senders: {
        noreply: {
            senderPrefix: "noreply",
            displayName: "MyApp",
        },
    },
});

Configuration

PropertyTypeDescription
domainstringCustom email domain (e.g., "mail.example.com")
hostedZoneIdstringRoute 53 hosted zone ID for DNS automation
hostedZoneDomainstringRoot domain of the hosted zone (e.g., "example.com")
sendersRecord<string, SenderConfig>Named sender configurations
defaultSenderstringDefault sender key (defaults to "noreply")
sandboxRecipientsstring[]Recipient addresses to verify in SES sandbox mode
timeoutSecondsnumberLambda timeout (defaults to 15)

On this page