Sending Email using Amazon AWS SES

Amazon AWS offers the best solution for sending robust emails in today’s market using SES(simple Email Service). In fact sending emails using Amazon AWS SES is definitely the cheaper means compared to other email service providers available in the today’s market. Here, the limitation with SES is, it can only be used to send emails just like an SMTP server. No doubt, SES is the best option for bulk email marketing’s and also transactional emails of low and high volume. The drawback here is SES doesn’t provide any UI for sending the emails but, it provides the flexibility of tracking the bounces and complaints using other services like SNS and SQS.
In this article, I will demonstrate you how to utilize AWS SES for sending transactional email using SMTP. You can configure SMTP credentials with your ERP for triggering emails from your applications. The below example is done in and C#.
You can download the SMTP credentials from your AWS SES management Console, from the option SMTP settings on the left side menu. Below is the reference for your understanding. Also make a note of the server name and port number which will be useful while initiating the SMTP session. In the next step, verify the sending domain or from email address from which you are planning to trigger emails. Under identity Management you have options to verify Domains and emails addresses. Kindly, note, unless the sending domain or sending email address is verified emails will not be triggered from SES.

SES SMTP Credentials

]1 SES SMTP Credentials

After this, let’s jump to the coding part. In the below code, am passing the TO email address, email subject and body to the method where the send email logic is executed. Here am using simple native method of sending emails using System.Net.Mail.MailMessage base class.

public static string sendEmailviaSES(string sendto, string mail_subject, string mail_body)
                const String FROM = "";  
 // Replace with your "From" address. This address must be verified.

                // Supply your SMTP credentials below. Note that your SMTP credentials are different from your AWS credentials.
                const String SMTP_USERNAME = "***********"; 

 // Replace with your SMTP username. 
                const String SMTP_PASSWORD ="*************************"; 
 // Replace with your SMTP password.

                // Amazon SES SMTP host name. 
                const String HOST = "";

                // Port we will connect to on the Amazon SES SMTP endpoint. We are choosing port 587 because we will use
                // STARTTLS to encrypt the connection.
                const int PORT = 587;

                // Create an SMTP client with the specified host name and port.
                using (System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(HOST, PORT))
                    // Create a network credential with your SMTP user name and password.
                    client.Credentials = new System.Net.NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);

                    //Use SSL when accessing Amazon SES. The SMTP session will begin on an unencrypted connection, and then 
                    //the client will issue a STARTTLS command to upgrade to an encrypted connection using SSL.
                    client.EnableSsl = true;
                    System.Net.Mail.MailMessage message1 = new System.Net.Mail.MailMessage(FROM, sendto, mail_subject, mail_body);

                    message1.IsBodyHtml = true;

               Return “sent”;
            catch (Exception ex)
                return ex;

This logic of sending emails via amazon ses best suits for sending transactional emails. You can check the article Configure SES to publish Notifications to SQS via SNS for publishing notifications and track bounces when an email is triggered from SES.