Skip to content

Instantly share code, notes, and snippets.

@zacharydanger
Created February 9, 2012 14:38
Show Gist options
  • Save zacharydanger/1780359 to your computer and use it in GitHub Desktop.
Save zacharydanger/1780359 to your computer and use it in GitHub Desktop.
Sample Rails ActionMailer config/initializer
# this file should be config/initializers/smtp.rb
config_file = File.join(Rails.root.to_s, '/config/smtp.yml')
if File.exists? config_file
if smtp_config = YAML.load_file(File.expand_path(config_file))[Rails.env]
MyApp::Application.config.action_mailer.delivery_method = :smtp
MyApp::Application.config.action_mailer.smtp_settings = smtp_config
end
end
---
development:
:address: localhost
:port: 1025
:domain: foobar.dev
test:
:address: localhost
:port: 1025
:domain: foobar.dev
production:
:address: localhost
:port: 25
:domain: mail.example.com
:user_name: username
:password: password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment