Simulating SES Bounce, Complaint, and Reject Events

Simulating SES Bounce, Complaint, and Reject Events

Triggering SES bounce, complaint, and reject notifications with simulator addresses, without sending real mail to any recipient.

Takahiro Iwasa
2 min read

SES provides simulator addresses for testing how an application handles bounce, complaint, and reject notifications without sending real mail to affected recipients. Details are available in the official documentation.

Prerequisites

Before starting, complete the following:

  1. Register an email address in your AWS SES.
  2. Enable Email Feedback Forwarding for the registered email address.

Email Feedback Forwarding Setup

Simulating Bounce

A bounce can be simulated with:

Terminal window
aws ses send-email \
--from <YOUR_EMAIL> \
--subject test \
--text test

You will receive an email at the address specified by the --from option, indicating a bounce occurred.

Bounce Simulation Example

Simulating Complaint

A complaint follows the same pattern, targeting a different simulator address:

Terminal window
aws ses send-email \
--from <YOUR_EMAIL> \
--subject test \
--text test

An email indicating a complaint will be sent to the --from address.

Complaint Simulation Example

Simulating Reject

A reject requires sending an email with an EICAR test file attachment, which SES’s virus scanning flags:

Terminal window
FROM=<YOUR_EMAIL>
MESSAGE='{"Data": "From: $FROM\nTo: $FROM\nSubject: test\nMIME-Version: 1.0\nContent-type: Multipart/Mixed; boundary=\"NextPart\"\n\n--NextPart\nContent-Type: text/plain\n\ntest\n\n--NextPart\nContent-Type: text/plain;\nContent-Disposition: attachment; filename=\"sample.txt\"\n\nX5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*\n\n--NextPart--"}'
MESSAGE=$(echo $MESSAGE | sed "s/\$FROM/$FROM/g")
aws ses send-raw-email \
--cli-binary-format raw-in-base64-out \
--raw-message "$MESSAGE"

You will receive a rejection notification email at the FROM address.

Reject Simulation Example

Conclusion

These three simulator addresses made it possible to trigger bounce, complaint, and reject notifications from SES without sending real mail to any actual recipient. [email protected] and [email protected] cover the two most common notification paths with nothing more than a plain send-email call, which makes it easy to exercise that handling logic long before any real recipient is involved. The reject case takes more effort — it needs send-raw-email with a MIME payload carrying an EICAR-flagged attachment rather than a simple text body — but that extra setup is exactly why it’s worth testing explicitly instead of assuming the same code path that handles bounces will handle a virus-scan rejection correctly.

About the author

Takahiro Iwasa

Takahiro Iwasa

Software Developer

This blog shares technical notes from hands-on projects—architecture, implementation, and AWS service integrations.