Monthly Archives: April 2011

Rails & Amazon SES: send emails with Amazon SES

Amazon AWS launched recently its own email service: Amazon SES: cheap prices and ability to send any type of emails, not just transactional.

In your Gemfile add:

gem "aws-ses", "~> 0.4.1", :require => 'aws/ses'

create an initializer in config/initializers

amazon_creds = YAML::load(open("#{RAILS_ROOT}/config/amazon.yml"))

# extend ActionMailer
ActionMailer::Base.custom_amazon_ses_mailer = AWS::SES::Base.new({
  :access_key_id => amazon_creds['access_key_id'],
  :secret_access_key => amazon_creds['secret_access_key']
})

Set delivery mehtod to amazon ses in environment.rb or in a specific environment as needed

ActionMailer::Base.delivery_method = :amazon_ses

If you need to monitor your sending activity there’s a simple sinatra application: https://github.com/nodanaonlyzuul/SESChange

happy mailing!