# -*- encoding : utf-8 -*-
require 'yaml'

begin
  options = YAML.load_file(Rails.root.join('config', 'mandrill.yml'))[Rails.env]

  ActionMailer::Base.smtp_settings = {
    :address   => "smtp.mandrillapp.com",
    :port      => 587,
    :user_name => options['username'],
    :password  => options['password'],
    :domain    => 'heroku.com'
  }
  ActionMailer::Base.delivery_method = :smtp

  MandrillMailer.configure do |config|
    config.api_key = options['api_key']
  end
rescue LoadError
  puts "The Mandrill configuration (config/mandrill.yml) is missing or malformed"
  exit(1)
end

# -*- encoding : utf-8 -*-
require 'yaml'

begin
  options = YAML.load_file(Rails.root.join('config', 'mandrill.yml'))[Rails.env]

  ActionMailer::Base.smtp_settings = {
    :address   => "smtp.mandrillapp.com",
    :port      => 587,
    :user_name => ENV["MANDRILL_USERNAME"],
    :password  => ENV["MANDRILL_PASSWORD"],
    :domain    => 'heroku.com'
  }
  ActionMailer::Base.delivery_method = :smtp

  MandrillMailer.configure do |config|
    config.api_key = ENV["MANDRILL_API_KEY"]
  end
rescue LoadError
  puts "The Mandrill configuration (config/mandrill.yml) is missing or malformed"
  exit(1)
end

Read env variables for Mandrill api_key, username, and password.
Read env variables for Mandrill api_key, username, and password.
