ruchir ruchir - 1 year ago 149
Ruby Question

Is it possible to use AWS SES with application on HEROKU?

I'd like to use Amazon SES to send mail from my application deployed on Heroku

Currently I am able to send mail from localhost, but not able to send mails from my application deployed on HEROKU

Answer Source

There's no reason why it cannot work. Basically the steps are as follow

  1. update your credentials to Heroku

    heroku config:set AWS_ACCESS_KEY_ID=xxx AWS_SECRET_ACCESS_KEY=yyy AWS_REGION=region
  2. update your Gemfile

    gem 'aws-sdk', '~> 2'
    gem 'aws-sdk-rails'

Then bundle install to take into effect

  1. configure Amazon SES to be your mail application, update config/environments/production.rb

    aws_credentials =['AWS_ACCESS_KEY_ID'], ENV['AWS_ACCESS_KEY_ID'])
    Aws::Rails.add_action_mailer_delivery_method(:aws_ses, credentials: aws_credentials, region: ENV['AWS_REGION'])
    config.action_mailer.delivery_method = :aws_ses

Then it should work

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download