- 
    
Task
 - 
    Resolution: Unresolved
 - 
    
Minor
 - 
    OS: Windows 10 1809
Java: Oracle JRE 1.8.0_20-b26
Jenkins: 2.189
Mailer Plugin: 1.24
Jenkins is run as a windows service
Browser: Firefox 68.0.2 
The settings under "E-Mail Notification" are configured to use SMTP Authentication with SSL.
Using "Test configuration" leads to an exception: "java.net.SocketException: Connection closed by remote host". The full stack trace is attached.
This only happens with the "Test configuration" button. Regular build-failed mails actually work fine.
Mail is configured like this (see also jenkins_mail_config.png):
SMTP Server: smtp-relay.gmail.com
 Use SMTP Authentication: checked
 User Name and Password: entered
 Use SSL: checked
 SMTP Port: 465
 Charset: UTF-8
 Test e-mail recipient: e-mail address entered
Logging the traffic with sslsplit shows that AUTH LOGIN was not performed:
220 smtp-relay.gmail.com ESMTP h25sm4317wmb.21 - gsmtp
 EHLO FIREBIRD
 250-smtp-relay.gmail.com at your service, [_IP redacted_]
 250-SIZE 157286400
 250-8BITMIME
 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
 250-ENHANCEDSTATUSCODES
 250-PIPELINING
 250-CHUNKING
 250 SMTPUTF8
 MAIL FROM:<redacted>
 550-5.7.1 Invalid credentials for relay [_IP redacted_]. The IP address you've
 550-5.7.1 registered in your G Suite SMTP Relay service doesn't match domain of
 550-5.7.1 the account this email is being sent from. If you are trying to relay
 550-5.7.1 mail from a domain that isn't registered under your G Suite account
 550-5.7.1 or has empty envelope-from, you must configure your mail server
 550-5.7.1 either to use SMTP AUTH to identify the sending domain or to present
 550-5.7.1 one of your domain names in the HELO or EHLO command. For more
 550-5.7.1 information, please visit
 550 5.7.1 https://support.google.com/a/answer/6140680#invalidcred h25sm4317wmb.21 - gsmtp
Build-failed mails work as expected with AUTH LOGIN:
20 smtp-relay.gmail.com ESMTP cf12sm48397ejb.11 - gsmtp
 EHLO FIREBIRD
 250-smtp-relay.gmail.com at your service, [_IP redacted_]
 250-SIZE 157286400
 250-8BITMIME
 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
 250-ENHANCEDSTATUSCODES
 250-PIPELINING
 250-CHUNKING
 250 SMTPUTF8
 AUTH LOGIN
 334 VXNlcm5hbWU6
 redacted
 334 UGFzc3dvcmQ6
 redacted
 235 2.7.0 Accepted
 MAIL FROM:<redacted>
 250 2.1.0 OK cf12sm48397ejb.11 - gsmtp
 RCPT TO:<redacted>
 250 2.1.5 OK cf12sm48397ejb.11 - gsmtp
 DATA
 354 Go ahead cf12sm48397ejb.11 - gsmtp
 Date: Sat, 17 Aug 2019 21:10:44 +0200 (CEST)
 From: Jenkins <redacted>
 To: redacted
 Message-ID: <14698696.4.1566069044700.JavaMail.FIREBIRD$@FIREBIRD>
 In-Reply-To: <21875298.1.1566064846550.JavaMail.FIREBIRD$@FIREBIRD>
 References: <21875298.1.1566064846550.JavaMail.FIREBIRD$@FIREBIRD>
 Subject: Build failed in Jenkins: Plakat.NET #1515
 MIME-Version: 1.0
 ...
- duplicates
 - 
                    
JENKINS-58768 Mailer doesn't authenticate properly with Gmail
-         
 - Closed
 
 -