How to Test Sending Email with Amazon SES on AWS Emulator
AWS Emulator lets you test email sending through the Amazon SES API locally, without an AWS account. This is for cases where your app sends email through SES, such as sign-up confirmation or password reset emails, and you want that code to run in a local development or test environment. This article covers registering a sender identity, sending with SendEmail, and sending with a template. The commands and output are copied from my test environment. I also note where the behavior differs from real SES.
The test environment was Ubuntu 24.04 (x86_64), AWS Emulator 1.0.556 (released November 21, 2026), and AWS CLI 2.42.1. I did not use an AWS account or credentials, so I did not check how things behave on real SES, whether email actually arrives, or what it costs. Where this article refers to real SES, the source is the official documentation. I did not test domain identities, sending over SMTP, sending events (the destinations for configuration set event publishing), sending from the AWS SDK, or how real SES counts sends across SES API v2 and the older API.
Start the emulator and point the AWS CLI at it
The installation is covered in more detail in a separate article, "How to Install AWS Emulator on Ubuntu and Get Started." In my test environment, I installed the Debian package from the Linux instructions after verifying its signature with gpg. The -t off flag at startup turns off the usage data that is sent to AWS by default (telemetry). The emulator keeps running in the terminal where you started it, so leave that terminal open.
$ aws-emulator -t off
In another terminal, set the environment variables from the official documentation.
export AWS_ENDPOINT_URL=https://127.0.0.1:9297
export AWS_SHARED_CREDENTIALS_FILE=~/.aws/emulator/9297/emulator_credentials
export AWS_CONFIG_FILE=~/.aws/emulator/9297/config
export AWS_CA_BUNDLE=~/.aws/emulator/9297/ca.pem
export AWS_EC2_METADATA_DISABLED=true
export AWS_DISABLE_HOST_PREFIX_INJECTION=true
export AWS_REGION=us-east-1
export AWS_DEFAULT_REGION=us-east-1
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_PROFILE
To check whether startup has finished, call the health check URL. If it returns ok, the emulator is ready.
$ for i in $(seq 30); do curl -sf --cacert ~/.aws/emulator/9297/ca.pem https://127.0.0.1:9297/__admin/health && break; sleep 1; done; echo
ok
The AWS CLI has two SES command groups: aws sesv2, which calls SES API v2, and aws ses, which calls the older API. This article mainly uses aws sesv2.
First, I checked the account status with aws sesv2 get-account. ProductionAccessEnabled was false, and the send limits were 200 emails per 24 hours and 1 email per second. On real SES, a new account starts in a restricted state called the sandbox, and these numbers match the sandbox limits.
$ aws sesv2 get-account
{
"DedicatedIpAutoWarmupEnabled": true,
"EnforcementStatus": "HEALTHY",
"ProductionAccessEnabled": false,
"SendQuota": {
"Max24HourSend": 200.0,
"MaxSendRate": 1.0,
"SentLast24Hours": -0.0
},
"SendingEnabled": true,
(以下略)
Without a registered sender identity, sending is rejected
If you send without any setup, the request is rejected with MessageRejected. The error says the sender address has not been verified.
$ aws sesv2 send-email --from-email-address sender@example.com --destination ToAddresses=recipient@example.com --content 'Simple={Subject={Data=Hello},Body={Text={Data=Hi}}}'
aws: [ERROR]: An error occurred (MessageRejected) when calling the SendEmail operation: Email address is not verified. The following identities failed the check in region US-EAST-1: sender@example.com
You need to register the sender in SES as an identity and complete verification. Create an email address identity with create-email-identity.
$ aws sesv2 create-email-identity --email-identity sender@example.com
{
"IdentityType": "EMAIL_ADDRESS",
"VerifiedForSendingStatus": false,
"DkimAttributes": {
"SigningEnabled": false,
"Status": "NOT_STARTED",
"SigningAttributesOrigin": "AWS_SES"
}
}
Right after creation, the status was PENDING (waiting for verification). Sending during this time returned the same MessageRejected error as before.
$ aws sesv2 get-email-identity --email-identity sender@example.com --query "[VerificationStatus,VerifiedForSendingStatus]" --output text
PENDING False
Sender verification finishes automatically in about 3 seconds
On real SES, creating an identity sends a verification email to that address. Verification is completed by opening the link in the email, which expires after 24 hours. In the emulator, the status changed without opening any link. I checked the status once per second. It became SUCCESS 2.5 seconds after I started checking, and the identity became usable for sending (VerifiedForSendingStatus was True).
$ s=$(date +%s.%N); for i in $(seq 30); do st=$(aws sesv2 get-email-identity --email-identity sender@example.com --query "[VerificationStatus,VerifiedForSendingStatus]" --output text); printf "%.1fs %s\n" $(perl -e "print $(date +%s.%N) - $s") "$st"; case "$st" in SUCCESS*) break;; esac; sleep 1; done
0.7s PENDING False
2.5s SUCCESS True
This timing is set in the emulator's publicly available source code. In the file that handles SES v2 state (state.rs), a constant named VERIFICATION_SETTLE is set to 3 seconds. According to the comment, real SES has no fixed time for verification to finish, so this value was chosen as a length during which PENDING is visible if you read the status right after creating the identity. The comment also says the value was kept no longer than necessary, because every client that uses a sender has to wait this long.
When your test code sets up a sender identity, add a step that waits until the status is SUCCESS before sending. This prevents sends from failing while the emulator is still verifying. The older get-identity-verification-attributes API also returned Success for the same identity.
$ aws ses get-identity-verification-attributes --identities sender@example.com
{
"VerificationAttributes": {
"sender@example.com": {
"VerificationStatus": "Success"
}
}
}
Register the recipient too, then send
In the real SES sandbox, recipient addresses must also be verified, except for the test recipients in the mailbox simulator. To keep the conditions the same as real SES, I also created recipient@example.com as an identity and waited until it reached SUCCESS.
$ aws sesv2 create-email-identity --email-identity recipient@example.com --query VerifiedForSendingStatus
false
$ for i in $(seq 30); do st=$(aws sesv2 get-email-identity --email-identity recipient@example.com --query VerificationStatus --output text); [ "$st" = SUCCESS ] && echo $st && break; sleep 1; done
SUCCESS
Once sender verification is complete, you can send with the same command as before. On success, a MessageId is returned. The 12-digit number in the MessageId was a sequence number that changed on each send, so I replaced it with a placeholder (<12桁の連番> in the output below means "12-digit sequence").
$ aws sesv2 send-email --from-email-address sender@example.com --destination ToAddresses=recipient@example.com --content 'Simple={Subject={Data=Hello},Body={Text={Data=Hi}}}'
{
"MessageId": "010001a1ff30bc35-30e0576d-0723-2116-1614-<12桁の連番>-000000"
}
Sending also worked with the older aws ses send-email command. The argument names change to --from and --message.
$ aws ses send-email --from sender@example.com --destination ToAddresses=recipient@example.com --message 'Subject={Data=Hello},Body={Text={Data=Hi}}'
{
"MessageId": "0100eaf9ccf733b7-60a77f3a-b527-a6c5-bf76-cacd8c5faa44-000000"
}
After I deleted the identity with delete-email-identity, sending from that address was rejected again with MessageRejected. The flow is summarized in the diagram below.

Send using a template
To insert values such as names into each email, use a template. As described in the official documentation on templates, you write placeholders like {{name}}. I put the subject and body in a JSON file.
$ cat /path/to/template.json
{"Subject":"{{name}}さん、ようこそ","Text":"{{name}}さん、登録ありがとうございます。"}
Create the template with create-email-template, then check the rendered result with test-render-email-template using sample values. The file path here is a placeholder.
$ aws sesv2 create-email-template --template-name welcome --template-content file:///path/to/template.json
$ aws sesv2 test-render-email-template --template-name welcome --template-data '{"name":"ねこ"}' --query RenderedTemplate --output text
Subject: =?UTF-8?B?44Gt44GT44GV44KT44CB44KI44GG44GT44Gd?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
ねこさん、登録ありがとうございます。
The Japanese subject was returned converted to a form that works in email headers (=?UTF-8?B?…?=). The sample name "neko" (Japanese for "cat") was inserted into the body. When sending, pass the template name in Template under --content, along with the values to insert as a JSON string.
$ aws sesv2 send-email --from-email-address sender@example.com --destination ToAddresses=recipient@example.com --content '{"Template":{"TemplateName":"welcome","TemplateData":"{\"name\":\"ねこ\"}"}}'
{
"MessageId": "010001a1ff30c798-5c8f7c90-baee-67c0-3de0-<12桁の連番>-000000"
}
Things to watch out for when testing with the emulator
Even if a send succeeds in the emulator, it may not succeed the same way on real SES. In my test environment, I found three behaviors to be careful about.
Sending to unverified recipients also succeeded. According to the sandbox documentation, while in the sandbox you can send only to verified addresses or domains, or to the mailbox simulator. In the emulator, sending to unverified@example.net, which I never registered as an identity, still returned a MessageId.
$ aws sesv2 send-email --from-email-address sender@example.com --destination ToAddresses=unverified@example.net --content 'Simple={Subject={Data=Hello},Body={Text={Data=Hi}}}'
{
"MessageId": "010001a1ff30bf67-a89c066f-ec76-fa3e-9ef9-<12桁の連番>-000000"
}
This difference is also recorded in the list of known unfixed issues in the AWS Emulator repository (issues/things-that-do-not-work). You cannot use the emulator to verify your error handling for a recipient that is rejected in the sandbox because it is not verified.
In the emulator, sends were counted separately for the new API and the older API. The three emails I sent with aws sesv2 (two to recipient@example.com and one to unverified@example.net) were counted in SentLast24Hours from aws sesv2 get-account. On the other hand, the older API's get-send-quota counted only the one email I sent with the older API. If you write a test that checks send counts in the emulator, read the count with the same API you used to send.
$ aws sesv2 get-account --query SendQuota
{
"Max24HourSend": 200.0,
"MaxSendRate": 1.0,
"SentLast24Hours": 3.0
}
$ aws ses get-send-quota
{
"Max24HourSend": 200.0,
"MaxSendRate": 1.0,
"SentLast24Hours": 1.0
}
I could not find a way to view the contents of sent emails. The only admin URL path listed in the emulator's help was the health check, /__admin/health. There is no path to retrieve the subject or body of a sent email afterward. In tests, you can confirm only that SendEmail succeeded and returned a MessageId, and that a template expands correctly with test-render-email-template. As the official documentation explains, the emulator does not send requests to AWS, so emails never reach real recipients.
$ aws-emulator --help | sed -n "/Admin routes/,\$p"
Admin routes:
GET /__admin/health
Return code of 200 indicates emulator working correctly.
The emulator is useful for checking the flow of creating a sender identity and waiting for verification, the way you call SendEmail, and template substitution. Recipient restrictions differ from real SES, and send counts were tracked separately by the two APIs, so do not rely on emulator results for those.





