Site5 is my host of choice when it comes to Ruby on Rails hosting. At this risk of sounding like a sponsored post, their dashboard, hosting options, customer service, and uptimes are solid.

I’m working on a project in which I’m using Devise for the authentication system but had a bit of a time getting the application to properly send email notifications.

According to Google results, this seems to be a relatively common problem so I’m sharing my configuration options here:

In /environments/production.rb:

config.action_mailer.default_url_options = { :host => "MyDomain.com" }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :sendmail
config.action_mailer.smtp_settings = {
  :address => "mail.MyDomain.com",
  :port => 25,
  :domain => "MyDomain.com",
  :authentication => :login,
  :user_name => "username+MyDomain.com",
  :password => "MyPassword",
}

Make sure that the value for :host for the default_url_options is for the domain to which the email address will link the user. For example, if your application runs on my.application.com, then that should be the value for the :host.

Other than that, this fires the email immediately.

Category:
Notes
Tags:

Join the conversation! 1 Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.