1) Firstly add add gem 'aws-sdk', '1.7.0' into your Gemfile
2) Create aws.rb inside initializers and then add valid amazon access key id and secret key as shown below. (aws.rb)
AWS.config(access_key_id: ENV['ACCESS_KEY_ID'], secret_access_key: ENV['SECRET_ACCESS_KEY'])
3) Add the Setup ACCESS_KEY_ID and SECRET_ACCESS_KEY into your application.yml file
default: &default
access_key_id: 'your acces key id'
secret_access_key: 'your secret access key'
development:
<<: *default
production:
access_key_id: 'your acces key id'
secret_access_key: 'your secret access key'
test:
<<: *default
4) To setup the feature in production mode add the following into your environments/production.rb
config.action_mailer.delivery_method = :amazon_ses
5) To setup in development mode add the following into your environments/development.rb
config.action_mailer.delivery_method = :amazon_ses
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
6) TO fix the following error (sample)
AWS::SimpleEmailService::Errors::MessageRejected in SessionsController#forgot_password
Email address is not verified.
7) Run the following command in console to verify
a) ses = AWS::SimpleEmailService.new(access_key_id: 'your access key', secret_access_key: 'you secret access key')
b) ses.identities.verify('email@yourdomain.com'). This is the same from email which you set while sending email. Once you run this command you will receive an email from amazon
Amazon SES Address Verificati on Request
One you approve your email then your email feature will start working.