Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I enable Devise to send out confirmation emails on Heroku?

I am on heroku so am not clear where and how to set it up so that devise can send out emails.

I actually have two directions to go:

  1. I am using sendgrid, so am wondering how it works with that.

  2. For my hand-rolled mailers, I use PostageApp, which I'd prefer because it allows me to see what's going on with my email. The way I use PostageApp is my Mailers are a class of PostageApp's mailer.

Thanks.

like image 695
Satchel Avatar asked May 07 '11 18:05

Satchel


1 Answers

In Rails 3 I used the following settings in config/environments/production.rb

# Disable delivery errors, bad email addresses will be ignored
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { :host => '##YOUR_PROJECTNAME##.heroku.com' }
ActionMailer::Base.smtp_settings = {
  :address    => "smtp.sendgrid.net",
  :port       => 25,
  :user_name  => ENV['SENDGRID_USERNAME'],
  :password   => ENV['SENDGRID_PASSWORD'],
  :domain     => ENV['SENDGRID_DOMAIN'],
  :authentication  => :plain
}

Note: you'll need to substitute in your project name - but all those ENV variables are populated for you automatically by heroku.

like image 130
Taryn East Avatar answered Oct 25 '22 17:10

Taryn East