annotate config/initializers/.svn/text-base/40-email.rb.svn-base @ 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
rev   line source
Chris@0 1 # Loads action_mailer settings from email.yml
Chris@0 2 # and turns deliveries on if configuration file is found
Chris@0 3
Chris@0 4 filename = File.join(File.dirname(__FILE__), '..', 'email.yml')
Chris@0 5 if File.file?(filename)
Chris@0 6 mailconfig = YAML::load_file(filename)
Chris@0 7
Chris@0 8 if mailconfig.is_a?(Hash) && mailconfig.has_key?(Rails.env)
Chris@0 9 # Enable deliveries
Chris@0 10 ActionMailer::Base.perform_deliveries = true
Chris@0 11
Chris@0 12 mailconfig[Rails.env].each do |k, v|
Chris@0 13 v.symbolize_keys! if v.respond_to?(:symbolize_keys!)
Chris@0 14 ActionMailer::Base.send("#{k}=", v)
Chris@0 15 end
Chris@0 16 end
Chris@0 17 end