phato.blog

Humble semi-technical blog of Pat Wangrungarun

SendGrid + Devise on Heroku

01 May 2013 in devise, heroku · view history

Let’s say I have a subdomain devsheet.phatograph.com and I want to configure SendGrid and Devise in Heroku, here are things to be done.

production.rb

Devise documentation and this post tell me to configure config.action_mailer.default_url_options as:

config.action_mailer.default_url_options = { :host => 'devsheet.phatograph.com' }

And from Heroku Dev Center’s post:

config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
  :address        => "smtp.sendgrid.net",
  :port           => "25",
  :authentication => :plain,
  :user_name      => ENV['SENDGRID_USERNAME'],
  :password       => ENV['SENDGRID_PASSWORD'],
  :domain         => ENV['SENDGRID_DOMAIN']
}

devise.rb

From Devise’s predefined configuration:

config.mailer_sender = "[email protected]"