Fixed issue #648 - Sending emails via SMTPS (Port 465 and SSL) not possible.

This commit is contained in:
Martin Edenhofer 2017-01-19 06:03:19 +01:00
parent 9a8327c51a
commit 24d8b79503

View file

@ -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]