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]