SendEmail
Source:
src/AWS/SES/SendEmail.ts
Runtime binding for sesv2:SendEmail.
Bind this operation to an EmailIdentity (and optionally a
ConfigurationSet) inside a function runtime to get a callable that sends
simple, raw, or templated email. The binding grants the function
ses:SendEmail (and the raw/templated variants) scoped to the identity,
the account’s templates, and the configuration set.
For an email-address identity, FromEmailAddress defaults to the identity
itself. For a domain identity, pass an address at the domain explicitly.
Note: while the account is in the SES sandbox, both the sender identity
must be verified and every recipient must be a verified identity or the
SES mailbox simulator (e.g. success@simulator.amazonses.com).
Sending Email
Section titled “Sending Email”Send a Simple Message
// initconst sendEmail = yield* SES.SendEmail(identity);
// runtimeconst result = yield* sendEmail({ Destination: { ToAddresses: ["success@simulator.amazonses.com"] }, Content: { Simple: { Subject: { Data: "Hello" }, Body: { Text: { Data: "Hello from SES." } }, }, },});// result.MessageIdSend Through a Configuration Set
const sendEmail = yield* SES.SendEmail(identity, configSet);Send a Templated Message
const result = yield* sendEmail({ Destination: { ToAddresses: ["customer@example.com"] }, Content: { Template: { TemplateName: "welcome-template", TemplateData: JSON.stringify({ name: "Ada" }), }, },});