Skip to content

Instantly share code, notes, and snippets.

@basti
Created May 28, 2013 09:53
Show Gist options
  • Save basti/5661700 to your computer and use it in GitHub Desktop.
Save basti/5661700 to your computer and use it in GitHub Desktop.
Quick Amazon SES setup for Rails app
Quick way to setup Amazon SES as a mailer for a Rails app
# config/initializers/amazon_ses.rb
ActionMailer::Base.add_delivery_method :ses, AWS::SES::Base,
:access_key_id => '##YOUR_KEY##',
:secret_access_key => '##YOUR_SECRET_KEY##'
gem 'aws-ses', :require => "aws/ses"
# config/environments/production.rb
config.action_mailer.delivery_method = :ses
@rozhok
Copy link

rozhok commented Jun 23, 2017

With this configuration mailer will use default SES endpoint (it will not take AWS_REGION from environment).
So, you'll have to configure it also if you're using non-default region:

ActionMailer::Base.add_delivery_method :ses, AWS::SES::Base,
                                       :access_key_id => ENV['AWS_ACCESS_KEY_ID'],
                                       :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],
                                       :server => 'email.' + ENV['AWS_REGION'] + '.amazonaws.com'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment