1import type * as sesv2 from "@distilled.cloud/aws/sesv2";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { EmailIdentityRef } from "./BindingHttp.ts";
5import type { ConfigurationSet } from "./ConfigurationSet.ts";
6import type { EmailIdentity } from "./EmailIdentity.ts";
7
8/**
9 * Runtime binding for `sesv2:SendCustomVerificationEmail`.
10 *
11 * Sends the branded verification email defined by a
12 * {@link CustomVerificationEmailTemplate} to a new email address, kicking off
13 * the address-verification flow. Pass the template name and the address to
14 * verify; SES takes the FROM address from the template.
15 *
16 * Bind it to the identity the function is allowed to VERIFY — SES authorizes
17 * this action against the identity of the address in the request, not against
18 * the template's FROM identity. Bind a domain to allow any address at it, or
19 * a single address to allow exactly that one. Without a bound identity the
20 * binding would let any holder send verification mail to arbitrary addresses.
21 * The identity is not injected into the request. Optionally bind a
22 * {@link ConfigurationSet}, which is injected into each request.
23 *
24 * The identity may be a managed {@link EmailIdentity} or a plain reference —
25 * `{ emailIdentity: "signups.example.com" }`. The reference form creates no
26 * resource edge and takes no ownership, so it can scope the grant to an
27 * identity the stack does not manage without a destroy ever deleting it.
28 *
29 * Provide the implementation with
30 * `Effect.provide(AWS.SES.SendCustomVerificationEmailHttp)`.
31 *
32 * Note: actually sending a custom verification email requires the account to
33 * be out of the SES sandbox — in the sandbox the call fails with the typed
34 * `BadRequestException`.
35 * ### Verifying Addresses
36 * **Example:** Send a Custom Verification Email
37 * ```typescript
38 * // init — the function may verify addresses at this identity's domain
39 * const sendVerification = yield* SES.SendCustomVerificationEmail(identity);
40 *
41 * // runtime
42 * const { MessageId } = yield* sendVerification({
43 * EmailAddress: "new-user@example.com",
44 * TemplateName: yield* template.templateName,
45 * });
46 * ```
47 *
48 * **Example:** Scope to a Domain the Stack Does Not Manage
49 * ```typescript
50 * // Any address at signups.example.com may be verified. No resource edge and
51 * // no ownership — nothing is created, adopted, or destroyed.
52 * const sendVerification = yield* SES.SendCustomVerificationEmail({
53 * emailIdentity: "signups.example.com",
54 * });
55 * ```
56 *
57 * **Example:** Attribute the Send to a Configuration Set
58 * ```typescript
59 * // ConfigurationSetName is injected into every request
60 * const sendVerification = yield* SES.SendCustomVerificationEmail(
61 * identity,
62 * configSet,
63 * );
64 * ```
65 *
66 * @binding
67 */
68export interface SendCustomVerificationEmail extends Binding.Service<
69 SendCustomVerificationEmail,
70 "AWS.SES.SendCustomVerificationEmail",
71 (
72 identity: EmailIdentity | EmailIdentityRef,
73 configurationSet?: ConfigurationSet,
74 ) => Effect.Effect<
75 (
76 request: Omit<
77 sesv2.SendCustomVerificationEmailRequest,
78 "ConfigurationSetName"
79 >,
80 ) => Effect.Effect<
81 sesv2.SendCustomVerificationEmailResponse,
82 sesv2.SendCustomVerificationEmailError
83 >
84 >
85> {}
86export const SendCustomVerificationEmail =
87 Binding.Service<SendCustomVerificationEmail>(
88 "AWS.SES.SendCustomVerificationEmail",
89 );