How to Simulate Bounce, Complaint, and Reject in AWS SES

How to Simulate Bounce, Complaint, and Reject in AWS SES

Takahiro Iwasa
Takahiro Iwasa
2 min read
SES

Introduction

SES users must maintain Bounce, Complaint, and Reject rates within acceptable thresholds to avoid penalties from AWS. Simulating these scenarios is essential to design effective responses and ensure compliance.

For more details, refer to the official AWS SES documentation.

Prerequisites

Ensure you have completed the following steps before starting:

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

Email Feedback Forwarding Setup

Simulating a Bounce

Use the following command to simulate a bounce:

aws ses send-email --from <YOUR_EMAIL> --to bounce@simulator.amazonses.com --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 a Complaint

To simulate a complaint, run this command:

aws ses send-email --from <YOUR_EMAIL> --to complaint@simulator.amazonses.com --subject test --text test

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

Complaint Simulation Example

Simulating a Reject

To simulate a reject, send an email with an EICAR test file attachment using the following script:

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

Understanding how to simulate bounce, complaint, and reject scenarios in AWS SES is critical for managing email deliverability and compliance. By practicing these simulations, you can proactively monitor and address potential issues, safeguarding your SES account.

Happy Coding! 🚀

Takahiro Iwasa

Takahiro Iwasa

Software Developer at KAKEHASHI Inc.
Involved in the requirements definition, design, and development of cloud-native applications using AWS. Now, building a new prescription data collection platform at KAKEHASHI Inc. Japan AWS Top Engineers 2020-2023.