DEV Community

Cover image for How to send an email with AWS SES and track events with Configuration Sets?

Posted on • Originally published at

How to send an email with AWS SES and track events with Configuration Sets?

Amazon Simple Email Service is a flexible and scalable email service that allows you to send mail from within any application.

Through this service, you can send emails and receive information on events that the recipient performs, such as mail delivered to the server, mail opening, or the recipient clicked on any link within the email.

To achieve that, you need to do the following steps:

Verify a Domain

The first thing you need to do is enter the domain that the email account belongs to so that Amazon can verify that the domain is yours. To do this, enter the Domains section and enter the domain:


Then, on the DNS settings you own (Godaddy, Hostgator, route53, etc.), you must create and enter the verification record sets that Amazon delivers.



Amazon must verify the domain, so you must enter this information in DNS settings.

If you are using Cloudfare or any CDN, you must enter this settings too.

Just wait 5 minutes to propagate the changes around the DNSs...


Verify Email address

Additionally, Amazon must verify a valid and existing email account. To do this, you must enter Amazon SES to the Email Address section, enter the email account and then go to the inbox of the specified mailbox and click on the link that allows you to verify the account.


Create a Configuration Set

To create a set of configurations in Amazon SES, go to the Configuration Sets section and click on the Create Configuration Set button.


Assign a name to the Configuration Set:


After assigning the name, it appears with no destinations created:


Enter into the configuration set:


You select the way you want to report the events:


For this example, I enabled Amazon SNS:


AWS SES reported these types of events when they occur. Select the one that suits you best.:

Send: A successful Amazon API call has been made to send mail and Amazon SES will attempt to deliver the mail.

Reject: Amazon SES accepted the email but determined that it contained malware and rejected it, thus, the email will not be sent.

Delivery: Amazon SES delivered the mail to the recipient's mail server.

Bounce: The recipient's mail server has rejected the mail, due to many causes, such as the inbox is full or the recipient does not exist.

Complaint: The email has been delivered to the recipient, but marks it as spam.

Click: The recipient clicked on one or more links included in the email.

Open: The recipient received the message and opened it in their email client.

Rendering Failure: The mail has not been sent due to a problem with the reading of the designated template for the mail.

Rendering Success: The email was sent using the templates configured in Amazon SES.


Select the SNS topic before configured to subscribe to notifications:


Save the configuration and a box will display the information entered:



To send a test email, select the domain, and click on the Send a Test Email button:


Then, enter the following fields, where the RAW field indicated the mail format:


Include the following text in the body of the message. This text includes a tag that indicates the that AWS used to report the events:

X-SES-MESSAGE-TAGS: DimensionName=DefaultValue
Subject: Test email
Content-Type: multipart/alternative;

Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

This is a test email with config sets.

<a href="">Amazon Web Services</a>
Enter fullscreen mode Exit fullscreen mode

Click on the send button and an email should reach the recipient's inbox:


One last thing...

To report an open email, Amazon SES includes a blank image at the end of the email so that when the user opens the email, it triggers an event that AWS captured.

For this reason, a restriction of the service is that the originating email account must be marked as a safe sender so when the recipient opens the email, it downloads all its content completely and could launch the event.

Other articles that you might like...

Do you like it? You can buy me a beer if you want.

Originally published at

Top comments (3)

juanc4milo profile image

Good that your problem was solved! Thanks for your feedback.

jasondayee profile image

It's clear !