From 3eaa54cc0116bef2efa3f08aaaf473ee0cf83e87 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 17 Feb 2017 15:50:23 +0100 Subject: [PATCH] Also do auth type detection for plain connection. --- lib/core_ext/net/smtp.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/core_ext/net/smtp.rb b/lib/core_ext/net/smtp.rb index 4e1fa3f45..2af11ba8d 100644 --- a/lib/core_ext/net/smtp.rb +++ b/lib/core_ext/net/smtp.rb @@ -23,8 +23,11 @@ module Net @socket = new_internet_message_io(tlsconnect(s)) # helo response may be different after STARTTLS do_helo helo_domain - # ADD auto detection of authtype - https://github.com/zammad/zammad/issues/240 - # set detected authtype based on smtp server capabilities + end + + # ADD auto detection of authtype - https://github.com/zammad/zammad/issues/240 + # set detected authtype based on smtp server capabilities + if user or secret if !authtype if auth_capable?(DEFAULT_AUTH_TYPE) authtype = DEFAULT_AUTH_TYPE @@ -36,8 +39,9 @@ module Net authtype = 'CRAM-MD5' end end - # /ADD auto detection of authtype - https://github.com/zammad/zammad/issues/240 end + # /ADD auto detection of authtype - https://github.com/zammad/zammad/issues/240 + authenticate user, secret, (authtype || DEFAULT_AUTH_TYPE) if user @started = true ensure