Search code examples
ruby-on-railsherokumandrill

Use Mandrill on Heroku without the addon


Heroku addon for mandrill is getting shutdown, but we'd still like to use mandrill with heroku. So the question is:

Is it possible to still use mandrill with heroku without the heroku addon for it? Can we just point rails mailer at mandrill smtp?


Solution

  • You do not need to use the Mandrill addon. Just configure ActionMailer in config/environments/production.rb (or whichever environment you are using on Heroku).

    config.action_mailer.default_url_options = { :host => 'example.com' }
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.smtp_settings = {
      address: 'smtp.mandrillapp.com',
      port: 587,
      domain: 'example.com',
      user_name: ENV['MANDRILL_USERNAME'],
      password: ENV['MANDRILL_PASSWORD']
    }
    

    Change example.com to your domain name.

    Then run heroku config:add MANDRILL_USER=yourmandrillusername and heroku config:add MANDRILL_PASSWORD=yourmandrillpassword. Now commit your changes to git and push them to heroku.