File: 40-email.rb

package info (click to toggle)
redmine 1.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 27,268 kB
  • ctags: 23,995
  • sloc: ruby: 177,441; sh: 506; perl: 232; sql: 96; makefile: 31
file content (17 lines) | stat: -rw-r--r-- 596 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Loads action_mailer settings from email.yml
# and turns deliveries on if configuration file is found

filename = ENV['RAILS_ETC'] ? File.join(ENV['RAILS_ETC'], 'email.yml') : 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