Reference doc for the `sst.aws.Email` component.
The Email
component lets you send emails in your app.
It uses Amazon Simple Email Service.
You can configure it to send emails from a specific email address or from any email addresses in a domain.
By default, new AWS SES accounts are in the sandbox mode and can only send email to verified email addresses and domains. It also limits your account has to a sending quota. To remove these restrictions, you need to request production access.
Sending from an email address
For using an email address as the sender, you need to verify the email address.
Sending from a domain
When you use a domain as the sender, you’ll need to verify that you own the domain.
Configuring DMARC
Link to a resource
You can link it to a function or your Next.js app to send emails.
Now in your function you can use the AWS SES SDK to send emails.
Constructor
Parameters
-
name
string
-
args
EmailArgs
-
opts?
ComponentResourceOptions
EmailArgs
dmarc?
Type Input
<
string
>
Default “v=DMARC1; p=none;”
The DMARC policy for the domain. This’ll create a DNS record with the given DMARC policy.
Only specify this if you are using a domain name as the sender
.
dns?
Type Input
<
false
|
sst.aws.dns
|
sst.cloudflare.dns
|
sst.vercel.dns
>
Default sst.aws.dns
The DNS adapter you want to use for managing DNS records. Only specify this if you
are using a domain name as the sender
.
Specify the hosted zone ID for the domain.
Domain is hosted on Cloudflare.
events?
Type Input
<
Object
[]
>
Default No event notifications
Configure event notifications for this Email component.
events[].bus?
Type Input
<
string
>
The ARN of the EventBridge bus to send events to.
events[].name
Type Input
<
string
>
The name of the event.
events[].topic?
Type Input
<
string
>
The ARN of the SNS topic to send events to.
events[].types
Type Input
<
Input
<
“
send
”
|
“
reject
”
|
“
bounce
”
|
“
complaint
”
|
“
delivery
”
|
“
delivery-delay
”
|
“
rendering-failure
”
|
“
subscription
”
|
“
open
”
|
“
click
”
>
[]
>
The types of events to send.
sender
Type Input
<
string
>
The email address or domain name that you want to send emails from.
Using an email address as the sender. You’ll need to verify the email address. When you deploy your app, you will receive an email from AWS SES with a link to verify the email address.
Using a domain name as the sender. You’ll need to verify that you own the domain. Once you verified, you can send emails from any email addresses in the domain.
To verify the domain, you need to add the verification records to your domain’s DNS.
This can be done automatically for the supported dns
adapters.
If the domain is hosted on Cloudflare.
transform?
Type Object
Transform how this component creates its underlying resources.
transform.configurationSet?
Type ConfigurationSetArgs
|
(
args
:
ConfigurationSetArgs
,
opts
:
ComponentResourceOptions
,
name
:
string
)
=>
void
Transform the SES configuration set resource.
transform.identity?
Type EmailIdentityArgs
|
(
args
:
EmailIdentityArgs
,
opts
:
ComponentResourceOptions
,
name
:
string
)
=>
void
Transform the SES identity resource.
Properties
configSet
Type Output
<
string
>
The name of the configuration set.
nodes
Type Object
The underlying resources this component creates.
nodes.configurationSet
Type ConfigurationSet
The Amazon SES configuration set.
nodes.identity
Type EmailIdentity
The Amazon SES identity.
sender
Type Output
<
string
>
The sender email address or domain name.
SDK
Use the SDK in your runtime to interact with your infrastructure.
Links
This is accessible through the Resource
object in the SDK.
-
configSet
string
The name of the configuration set.
-
sender
string
The sender email address or domain name.
Methods
static get
Parameters
The name of the component.name
string
The email address or domain name of the existing SES identity.sender
Input
<
string
>
-
opts?
ComponentResourceOptions
Returns Email
Reference an existing Email component with the given Amazon SES identity. This is useful when you create an SES identity in one stage and want to share it in another stage. It avoids having to create a new Email component in the other stage.
Imagine you create an Email component in the dev
stage. And in your personal stage frank
,
instead of creating a new component, you want to share the one from dev
.