Skip to content

Configuring Email

Stephen von Takach edited this page Dec 12, 2016 · 2 revisions

Amazon SES

Add the gem to your Gemfile:

gem 'aws-ses', '~> 0.4.4', require: 'aws/ses'

Extend ActionMailer in config/initializers/amazon_ses.rb:

ActionMailer::Base.add_delivery_method :ses, AWS::SES::Base,
  access_key_id: ENV['AMAZON_ACCESS_KEY'],
  secret_access_key: ENV['AMAZON_SECRET_KEY']

Set the delivery method in config/environments/{staging,production}.rb:

config.action_mailer.delivery_method = :ses

GMail

As Actionmailer now uses the Mail Gem, this becomes as simple as adding to your config/environments/$RAILS_ENV.rb file:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address:          	'smtp.gmail.com',
  port:             	587,
  domain:           	'example.com',
  user_name:        	'<username>',
  password:         	'<password>',
  authentication:   	'plain',
  enable_starttls_auto: true  }

Testing

Previewing Emails