From 36415b0c7360971bb352994a0cd4fbdf717eb39e Mon Sep 17 00:00:00 2001 From: Hexagon Date: Fri, 26 Nov 2010 20:00:22 +0100 Subject: [PATCH] Its now possible to use smtp-servers with no authentication --- config/app_config.yml.example | 4 ++-- config/initializers/mailer_config.rb | 26 +++++++++++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/config/app_config.yml.example b/config/app_config.yml.example index 29cbccd95..e224d47e9 100644 --- a/config/app_config.yml.example +++ b/config/app_config.yml.example @@ -56,9 +56,9 @@ default: # Sender address in diaspora's outgoing mail. smtp_sender_address: 'no-reply@example.com' - # Authentication required to send mail. One of "plain", + # If authentication is needed, change this to one of "plain", # "login" or "cram-md5" - smtp_authentication: 'plain' + smtp_authentication: 'none' # Credentails possibly required to log in to SMTP server if # smtp_authentication != 'plain' diff --git a/config/initializers/mailer_config.rb b/config/initializers/mailer_config.rb index b334cdb42..25cd82ce5 100644 --- a/config/initializers/mailer_config.rb +++ b/config/initializers/mailer_config.rb @@ -6,14 +6,22 @@ Diaspora::Application.configure do config.action_mailer.default_url_options = {:host => APP_CONFIG[:terse_pod_url]} unless Rails.env == 'test' || APP_CONFIG[:mailer_on] != true config.action_mailer.delivery_method = :smtp - config.action_mailer.smtp_settings = { - :address => APP_CONFIG[:smtp_address], - :port => APP_CONFIG[:smtp_port], - :domain => APP_CONFIG[:smtp_domain], - :authentication => APP_CONFIG[:smtp_authentication], - :user_name => APP_CONFIG[:smtp_username], - :password => APP_CONFIG[:smtp_password], - :enable_starttls_auto => true - } + if APP_CONFIG[:smtp_authentication] == "none" + config.action_mailer.smtp_settings = { + :address => APP_CONFIG[:smtp_address], + :port => APP_CONFIG[:smtp_port], + :domain => APP_CONFIG[:smtp_domain] + } + else + config.action_mailer.smtp_settings = { + :address => APP_CONFIG[:smtp_address], + :port => APP_CONFIG[:smtp_port], + :domain => APP_CONFIG[:smtp_domain], + :authentication => APP_CONFIG[:smtp_authentication], + :user_name => APP_CONFIG[:smtp_username], + :password => APP_CONFIG[:smtp_password], + :enable_starttls_auto => true + } + end end end