diff options
author | Andreas Schneider <asn@cynapses.org> | 2011-01-03 15:55:26 +0300 |
---|---|---|
committer | Alec Leamas <leamas.alec@gmail.com> | 2011-01-08 20:57:24 +0300 |
commit | 0c58d9814b0b420ee598105beac4048d195ed158 (patch) | |
tree | fff148f2a849ee088114b9757cbe8470cb183d2f /config | |
parent | 9baf7ff1575c00ab6271ce20e77a1559c2f0e0df (diff) |
mailer: Added support for /usr/sbin/sendmail.
This fixes bug #788.
Diffstat (limited to 'config')
-rw-r--r-- | config/app_config.yml.example | 7 | ||||
-rw-r--r-- | config/initializers/mailer_config.rb | 38 |
2 files changed, 30 insertions, 15 deletions
diff --git a/config/app_config.yml.example b/config/app_config.yml.example index 5d2617fd6..f442e08b1 100644 --- a/config/app_config.yml.example +++ b/config/app_config.yml.example @@ -46,6 +46,10 @@ default: # ActionMailer class. mailer_on: false + # This chooses which mailer should be used. 'smtp' for a smtp + # connection or 'sendmail' to use the sendmail binary. + mailer_method: 'smtp' + # Address/port to smtp server handing outgoing mail. smtp_address: 'smtp.example.com' smtp_port: '587' @@ -66,6 +70,9 @@ default: smtp_username: 'smtp_username' smtp_password: 'secret' + # The path to the sendmail binary. + sendmail_location: '/usr/sbin/sendmail' + #google analytics key, if false, it won't include the javascript google_a_site: false diff --git a/config/initializers/mailer_config.rb b/config/initializers/mailer_config.rb index c24d21d95..974e55953 100644 --- a/config/initializers/mailer_config.rb +++ b/config/initializers/mailer_config.rb @@ -5,23 +5,31 @@ Diaspora::Application.configure do config.action_mailer.default_url_options = {:host => AppConfig[:pod_uri].host} unless Rails.env == 'test' || AppConfig[:mailer_on] != true - config.action_mailer.delivery_method = :smtp - if AppConfig[:smtp_authentication] == "none" - config.action_mailer.smtp_settings = { - :address => AppConfig[:smtp_address], - :port => AppConfig[:smtp_port], - :domain => AppConfig[:smtp_domain] + if AppConfig[:mailer_method] == "sendmail" + config.action_mailer.delivery_method = :sendmail + config.action_mailer.sendmail_settings = { + :location => AppConfig[:sendmail_location] } else - config.action_mailer.smtp_settings = { - :address => AppConfig[:smtp_address], - :port => AppConfig[:smtp_port], - :domain => AppConfig[:smtp_domain], - :authentication => AppConfig[:smtp_authentication], - :user_name => AppConfig[:smtp_username], - :password => AppConfig[:smtp_password], - :enable_starttls_auto => true - } + config.action_mailer.delivery_method = :smtp + if AppConfig[:smtp_authentication] == "none" + config.action_mailer.smtp_settings = { + :address => AppConfig[:smtp_address], + :port => AppConfig[:smtp_port], + :domain => AppConfig[:smtp_domain], + :enable_starttls_auto => false + } + else + config.action_mailer.smtp_settings = { + :address => AppConfig[:smtp_address], + :port => AppConfig[:smtp_port], + :domain => AppConfig[:smtp_domain], + :authentication => AppConfig[:smtp_authentication], + :user_name => AppConfig[:smtp_username], + :password => AppConfig[:smtp_password], + :enable_starttls_auto => true + } + end end end end |