-1

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

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139
ruchir
  • 175
  • 1
  • 1
  • 9

1 Answers1

5

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::Credentials.new(ENV['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

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139