简体   繁体   中英

Sending Devise Confirmation Mailer with Mandrill through My Rails App on Heroku

I've got a Ruby on Rails app hosted with Heroku.

I'm using Devise for User Authentication. Trying to get Mandrill to send the Devise confirmation email.

I'm getting the following error in my heroku logs

Sent mail to EXAMPLE@gmail.com (23.4ms)
2015-02-04T00:38:02.334898+00:00 app[web.1]: Completed 500 Internal Server Error in 335ms

Note: the email is not being received by EXAMPLE@gmail.com.

Here's the code for Mandrill in my config/environments/production.rb

config.action_mailer.default_url_options = { :host => "example.herokuapp.com" }

config.action_mailer.smtp_settings = {
  :port =>           '587',
  :address =>        'smtp.mandrillapp.com',
  :enable_starttls_auto => true,
  :user_name =>      ENV['EXAMPLE@heroku.com'],
  :password =>       ENV['EXAMPLE'],
  :authentication => 'login',
  :domain => 'example.herokuapp.com'
}

EXAMPLE in the code above is actually replaced by my account information.

What am I missing?

I ended up switching to SendGrid as a Heroku AddOn and it solved my problem.

Here's the code that ended up working for me in config/environments/production.rb:

  config.action_mailer.default_url_options = { :host => "http://www.EXAMPLE.com" }

  config.action_mailer.smtp_settings = {
    :user_name => 'EXAMPLE',
    :password => 'EXAMPLE',
    :domain => 'EXAMPLE.com',
    :address => 'smtp.sendgrid.net',
    :port => 587,
    :authentication => :plain,
    :enable_starttls_auto => true
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM