Created
July 13, 2011 00:53
-
-
Save unixmonkey/1079519 to your computer and use it in GitHub Desktop.
email configuration for rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Loads ActionMailer settings from config/email.yml | |
| # and turns deliveries on only if configuration block is found | |
| config_file = Rails.root.join('config','email.yml') | |
| if File.file?(config_file) | |
| mailconfig = YAML::load_file(config_file) | |
| if mailconfig.is_a?(Hash) && mailconfig.has_key?(Rails.env) | |
| # enable deliveries | |
| ActionMailer::Base.perform_deliveries = true | |
| mailconfig[Rails.env].each do |key, value| | |
| value.symbolize_keys! if value.respond_to?(:symbolize_keys!) | |
| ActionMailer::Base.send("#{key}=", value) | |
| end | |
| else | |
| # disable deliveries | |
| ActionMailer::Base.perform_deliveries = false | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| development: | |
| delivery_method: smtp | |
| smtp_settings: | |
| address: smtp.gmail.com | |
| port: 587 | |
| domain: gmail.com | |
| user_name: foo | |
| password: bar | |
| authentication: plain | |
| enable_starttls_auto: true | |
| default_url_options: | |
| host: localhost | |
| protocol: http | |
| port: 3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment