view config/initializers/40-email.rb @ 436:4eb486dbf730 bug_169

If the remote repo URL changes, move aside the existing local mirror and start afresh. (Not yet tested: checkpointing this prior to working on a different aspect of the problem)
author Chris Cannam
date Mon, 06 Jun 2011 12:53:06 +0100
parents 513646585e45
children
line wrap: on
line source
# Loads action_mailer settings from email.yml
# and turns deliveries on if configuration file is found

filename = File.join(File.dirname(__FILE__), '..', 'email.yml')
if File.file?(filename)
  mailconfig = YAML::load_file(filename)

  if mailconfig.is_a?(Hash) && mailconfig.has_key?(Rails.env)
    # Enable deliveries
    ActionMailer::Base.perform_deliveries = true
    
    mailconfig[Rails.env].each do |k, v|
      v.symbolize_keys! if v.respond_to?(:symbolize_keys!)
      ActionMailer::Base.send("#{k}=", v)
    end
  end
end