juanc4milo
Posted on November 6, 2020
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:
Test
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-CONFIGURATION-SET: myConfigSetsName
X-SES-MESSAGE-TAGS: DimensionName=DefaultValue
From: emailfrom@domainexample.com
To: emailto@domainexample.com
Subject: Test email
Content-Type: multipart/alternative;
boundary="----=_boundary"
------=_boundary
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
This is a test email with config sets.
<a href="https://aws.amazon.com/">Amazon Web Services</a>
------=_boundary
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...
- Redis - Instalación y Configuración
- AWS S3 Batch Operations
- AWS S3 Inventory
- Qué ofrece y cómo se configura AWS Elasticache?
- Qué ofrece y cómo se configura Elasticache en AWS?
- How to use Redis with Spring in Java
Do you like it? You can buy me a beer if you want.
Originally published at juanc4milo.dev
Posted on November 6, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.