Follow Along as I Stumble on the Path to Learning RoR

Using Amazon SES to Send Emails from Rails

I wanted to switch from Sendgrid to Amazon SES to send emails because of the difference in pricing.  Adding Amazon SES to your Rails app is just as simple as adding Sendgrid would be.  I was able to set it up based on one of the answers to this Stack Overflow questions.  There’s a gem for this, but I prefer not using a gem when the solution is this simple.

  1. Sign-up for your Amazon SES account
  2. In your management console for Amazon SES, click the button for “Verify a New Sender”
  3. Specify the email address you want to send your emails from
  4. Add an email to test receiving emails at (you can only send to verified email addresses until you get production access)
  5. Verify your email by clicking the confirmation link from the automated email Amazon sends you
  6. Go back to Amazon SES, and click on the left side for SMTP settings
  7. Click the button for “Create My SMTP credentials”
  8. Record the user name and password created
  9. Add this to your development and production.rb files:
config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
      :address => "email-smtp.us-east-1.amazonaws.com",
      :user_name => "..." # Your SMTP user here.
      :password => "...", # Your SMTP password here.
      :authentication => :login,
      :enable_starttls_auto => true
  }

You should be all set - request production access once you've tested that your app is sending the emails ok.
Advertisements

Comments are closed.