Rails::Initializer.run do |config|
# other stuff ...
config.after_initialize do
if config.frameworks.include?(:action_mailer) and RAILS_ENV != 'test'
smtp_config_file = File.join(RAILS_ROOT, "config", "mailer.yml")
if File.exist? smtp_config_file
settings = YAML::load(ERB.new(File.read(smtp_config_file)).result)
config.action_mailer.smtp_settings = (settings[RAILS_ENV] || {}).symbolize_keys
end
end
end
end