EmailIdentity
Source:
src/AWS/SES/EmailIdentity.ts
An Amazon SES v2 email identity — a verified email address or domain that you send email from.
Creating the identity starts verification: email-address identities receive
a verification email, and domain identities get Easy DKIM tokens (exposed
as the dkimTokens attribute) to publish as CNAME records. The identity
is usable for sending once verificationStatus is SUCCESS.
Creating Identities
Section titled “Creating Identities”Domain Identity
import * as SES from "alchemy/AWS/SES";
const identity = yield* SES.EmailIdentity("Sender", { emailIdentity: "mail.example.com",});// publish identity.dkimTokens as CNAME records to verifyEmail Address Identity
const identity = yield* SES.EmailIdentity("Sender", { emailIdentity: "hello@example.com",});// SES emails hello@example.com a verification linkConfiguration Set Association
Section titled “Configuration Set Association”const configSet = yield* SES.ConfigurationSet("Tracking", {});const identity = yield* SES.EmailIdentity("Sender", { emailIdentity: "mail.example.com", configurationSetName: configSet.configurationSetName,});DKIM and Feedback
Section titled “DKIM and Feedback”Turn Easy DKIM Signing Off
// Omit the prop entirely to leave SES's current setting alone.const identity = yield* SES.EmailIdentity("Sender", { emailIdentity: "mail.example.com", dkimSigningEnabled: false,});Stop Forwarding Bounces and Complaints by Email
// Turn this off once a configuration set event destination is handling// bounces and complaints, so they stop arriving as mail.const identity = yield* SES.EmailIdentity("Sender", { emailIdentity: "mail.example.com", feedbackForwardingEnabled: false,});Custom MAIL FROM Domain
Section titled “Custom MAIL FROM Domain”// mailFromDomain must be a subdomain of the identity, and needs MX and// SPF records published before SES will use it.const identity = yield* SES.EmailIdentity("Sender", { emailIdentity: "mail.example.com", mailFromDomain: "bounce.mail.example.com", // Reject rather than silently falling back to the SES default when the // MX record cannot be read. mailFromBehaviorOnMxFailure: "REJECT_MESSAGE",});Sending Email at Runtime
Section titled “Sending Email at Runtime”// initconst sendEmail = yield* SES.SendEmail(identity);
// runtimeconst result = yield* sendEmail({ FromEmailAddress: "hello@mail.example.com", Destination: { ToAddresses: ["customer@example.com"] }, Content: { Simple: { Subject: { Data: "Welcome!" }, Body: { Text: { Data: "Hello from SES." } }, }, },});