Create a ruby file in #{RAILS_ROOT}/config/initializers/ with the following code
# Load mail configuration if not in test environment
if RAILS_ENV != 'test'
email_settings = YAML::load(File.open("#{RAILS_ROOT}/config/email.yml"))
ActionMailer::Base.smtp_settings = email_settings[RAILS_ENV] unless email_settings[RAILS_ENV].nil?
end
And then create #{RAILS_ROOT}/config/email.yml with the following
development: :address: smtp.server.com :port: 25 :authentication: plain :user_name: user :password: pass production: :address: smtp.server.com :port: 25 :authentication: plain :user_name: user :password: pass
And that's all.
Discussion