Skip to content

SendCustomVerificationEmail

Source: src/AWS/SES/SendCustomVerificationEmail.ts

Runtime binding for sesv2:SendCustomVerificationEmail.

Sends the branded verification email defined by a CustomVerificationEmailTemplate to a new email address, kicking off the address-verification flow. Pass the template name and the address to verify; SES takes the FROM address from the template.

Bind it to the identity the function is allowed to VERIFY — SES authorizes this action against the identity of the address in the request, not against the template’s FROM identity. Bind a domain to allow any address at it, or a single address to allow exactly that one. Without a bound identity the binding would let any holder send verification mail to arbitrary addresses. The identity is not injected into the request. Optionally bind a ConfigurationSet, which is injected into each request.

The identity may be a managed EmailIdentity or a plain reference — { emailIdentity: "signups.example.com" }. The reference form creates no resource edge and takes no ownership, so it can scope the grant to an identity the stack does not manage without a destroy ever deleting it.

Provide the implementation with Effect.provide(AWS.SES.SendCustomVerificationEmailHttp).

Note: actually sending a custom verification email requires the account to be out of the SES sandbox — in the sandbox the call fails with the typed BadRequestException.

Send a Custom Verification Email

// init — the function may verify addresses at this identity's domain
const sendVerification = yield* SES.SendCustomVerificationEmail(identity);
// runtime
const { MessageId } = yield* sendVerification({
EmailAddress: "new-user@example.com",
TemplateName: yield* template.templateName,
});

Scope to a Domain the Stack Does Not Manage

// Any address at signups.example.com may be verified. No resource edge and
// no ownership — nothing is created, adopted, or destroyed.
const sendVerification = yield* SES.SendCustomVerificationEmail({
emailIdentity: "signups.example.com",
});

Attribute the Send to a Configuration Set

// ConfigurationSetName is injected into every request
const sendVerification = yield* SES.SendCustomVerificationEmail(
identity,
configSet,
);