Fixed issue#224 - Send all mails via sendmail - allow SMTP connection with no user/password (without auth).
This commit is contained in:
parent
2111145fb1
commit
8004e44454
1 changed files with 9 additions and 4 deletions
|
@ -49,16 +49,21 @@ class Channel::Driver::Smtp
|
||||||
options[:openssl_verify_mode] = 'none'
|
options[:openssl_verify_mode] = 'none'
|
||||||
end
|
end
|
||||||
mail = Channel::EmailBuild.build(attr, notification)
|
mail = Channel::EmailBuild.build(attr, notification)
|
||||||
mail.delivery_method :smtp, {
|
smtp_params = {
|
||||||
openssl_verify_mode: options[:openssl_verify_mode],
|
openssl_verify_mode: options[:openssl_verify_mode],
|
||||||
address: options[:host],
|
address: options[:host],
|
||||||
port: options[:port],
|
port: options[:port],
|
||||||
domain: options[:domain],
|
domain: options[:domain],
|
||||||
user_name: options[:user],
|
|
||||||
password: options[:password],
|
|
||||||
enable_starttls_auto: options[:enable_starttls_auto],
|
enable_starttls_auto: options[:enable_starttls_auto],
|
||||||
authentication: options[:authentication],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# add authentication only if needed
|
||||||
|
if options[:user] && !options[:user].empty?
|
||||||
|
smtp_params[:user_name] = options[:user]
|
||||||
|
smtp_params[:password] = options[:password]
|
||||||
|
smtp_params[:authentication] = options[:authentication]
|
||||||
|
end
|
||||||
|
mail.delivery_method :smtp, smtp_params
|
||||||
mail.deliver
|
mail.deliver
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue