From 24d8b79503d6f320ad6d6020db5014dd1890316e Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 19 Jan 2017 06:03:19 +0100 Subject: [PATCH] Fixed issue #648 - Sending emails via SMTPS (Port 465 and SSL) not possible. --- app/models/channel/driver/smtp.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/channel/driver/smtp.rb b/app/models/channel/driver/smtp.rb index 646706d25..d678a40f0 100644 --- a/app/models/channel/driver/smtp.rb +++ b/app/models/channel/driver/smtp.rb @@ -30,7 +30,11 @@ class Channel::Driver::Smtp if !options.key?(:port) || options[:port].empty? options[:port] = 25 end - + if !options.key?(:ssl) + if options[:port].to_i == 465 + options[:ssl] = true + end + end if !options.key?(:domain) # set fqdn, if local fqdn - use domain of sender fqdn = Setting.get('fqdn') @@ -57,6 +61,11 @@ class Channel::Driver::Smtp enable_starttls_auto: options[:enable_starttls_auto], } + # set ssl if needed + if options[:ssl].present? + smtp_params[:ssl] = options[:ssl] + end + # add authentication only if needed if options[:user].present? smtp_params[:user_name] = options[:user]