What is Amazon SES?
Amazon SES is an email platform that provides an easy, cost-effective way to send and receive email using your own email addresses and domains.
Sending Email with Amazon SES using SMTP
You can use Simple Mail Transfer Protocol(SMTP) to send emails by using Amazon SES. You need an Amazon SES SMTP username and password to access the Amazon SES SMTP interface.
To create SMTP credentials:
1. Sign into the AWS Management Console and open the Amazon SES console at https://console.aws.amazon.com/ses
2. In the navigation pane, click SMTP Settings.
3. In the content pane, click Create My SMTP Credentials.
4. In the Create User for SMTP dialog box, you will see that an SMTP username has been filled in for you. You can accept this suggested username or enter a different one. To proceed, click Create
5. Click on Show User SMTP Credentials. Your SMTP credentials will be displayed on the screen; copy them and store them in a safe place. You can also click Download Credentials to download a file that contains your credentials.
After creating your SMTP credentials, open the Verified Senders/Email Addresses screen. Before you can send an email using Amazon SES, you have to own an address or addresses which are going to be used as senders across the SES SMTP mail servers.
Configure mailer with SMTP with rails app:
Add the following code in config/environments/*.rb
Then add following code in mailers/ses_mailer.rb
Note: If your account is in Amazon SES sandbox, then you must also verify the email address of every recipient. For moving out of the sandbox, see Moving Out of the Amazon SES Sandbox.
You can track your email sending statistics on Sending Statistics of Amazon Console.
Sending emails using aws-ses gem:
1. Add aws-ses to the gem file – https://github.com/drewblas/aws-ses
2. Extend ActionMailer in config/initializers/your_config_file.rb, where config_file.rb is the name of the file which contains initialization routines for ses gem:
3. Then set the delivery method in `config/environments/*.rb` as appropriate:
You are now ready to send emails from rails app through Amazon SES. Just make sure you have verified email addresses through which you are going to send the emails and you are out of Amazon SES sandbox. Happy Mailing!!