Small improvement, set domain for smtp if Zammad fqdn is not configured (e. g. in development environments).

This commit is contained in:
Martin Edenhofer 2016-11-07 12:01:55 +01:00
parent 15a23f3723
commit e16b3c3e48

View file

@ -31,7 +31,16 @@ class Channel::Driver::Smtp
options[:port] = 25
end
if !options.key?(:domain)
options[:domain] = Setting.get('fqdn')
# set fqdn, if local fqdn - use domain of sender
fqdn = Setting.get('fqdn')
if fqdn =~ /(localhost|\.local^|\.loc^)/i && (attr['from'] || attr[:from])
domain = Mail::Address.new(attr['from'] || attr[:from]).domain
if domain
fqdn = domain
end
end
options[:domain] = fqdn
end
if !options.key?(:enable_starttls_auto)
options[:enable_starttls_auto] = true