Mandrill for Rails Mailers on Heroku

I have been busy for the last week trying to get my mailers to work correctly on Heroku. Even though you would think that this would be easy, for some reason I had the hardest time finding the correct information.

In order to get it right, I had to phone a friend….literally. I had intended for this to be a step by step guide for future reference, but instead I am just gonna drop the code(a.k.a. mic).


config.action_mailer.default_url_options = { :host => ''
        Rails.application.routes.default_url_options[:host] = ''
          config.action_mailer.delivery_method = :smtp
          config.action_mailer.perform_deliveries = true
          config.action_mailer.raise_delivery_errors = false
          config.action_mailer.default :charset => "utf-8"
          config.action_mailer.smtp_settings = {
              :port => '587',
              :address => '',
              :user_name => ENV['MANDRILL_USERNAME'],
              :password => ENV['MANDRILL_APIKEY'],
              :domain => '',
              :authentication => :plain
        ActionMailer::Base.delivery_method = :smtp
        config.action_controller.include_all_helpers = true
        ActionMailer::Base.default :from => "MyApp<>"

ok…that was a bit dramatic. So I will break it down for you. This code above needs to be present in your production.rb file for rails app when you are using Mandrill.

What I didn’t know at first, that I know know is…… that in addition to adding the mandrill gem, you will also need to create the heroku add on. There is a good walkthru for adding the Heroku mandrill addon on Heroku’s site.

You should use it, and make sure that you have all the code in all the right places. And save yourself a few days of agony :)


Now read this


Being a junior developer is awesome, amazing, and scary at the same time. I often say that I feel like Harry Potter. At Hogwarts, (a.k.a. your job) you are just a little wizard. You can’t cast spells properly, you fall of your broom.... Continue →