Integrate AWS SES in your app using AWS-SDK
Amazon Simple Email Service (SES) is an email service that enables us to send mail from within any application.
You just need to follow few steps and it’s done. It’s affordable, flexible, and scalable. With Amazon SES, you can send email securely, globally, and at scale.
Prerequisites
- The first and foremost requirement is an AWS account.
- AWS user credentials → ACCESS_KEY, SECRET_KEY. If you don’t have credentials, go and checkout IAM.
- A domain name or email, Let’s continue with the domain, remember you would need to add some DNS records to verify your domain to use SES.
- aws-sdk package in your app. check out https://www.npmjs.com/package/aws-sdk for more information.
That’s all we need!
AWS SES setup via console:
Note: I am using the new console. If you’re using Sandbox environment, you would need to verify all recipients and senders. You can also request production access by simply raising a ticket to the AWS support center.
- Click on create Identity.
- Domain → Enter your domain name. Leave rest options default, we can change those later, I’ve talked in detail about SES in my other article.
3. Click on create Identity.
4. In the Authentication tab under the DomainKeys Identified Mail (DKIM), you must be seeing the DNS records. Go to your domain provider and configure those records.
Note: If your domain is registered with Amazon Route 53, Amazon SES will automatically update your domain’s DNS server with the necessary records.
5. Once you are done, wait for probably a few minutes, you will see the identity status Verified.
Code
You just need to create an SES client and invoke the appropriate method. It’s very simple.
And that’s it!
Please comment if you face any difficulty.
Happy Coding!