I am trying to set up the email notification push in Jenkins. Getting error:
java.net.SocketException: Connection closed by remote host
at sun.security.ssl.SSLSocketImpl.checkWrite(Unknown Source)
at sun.security.ssl.AppOutputStream.write(Unknown Source)
at com.sun.mail.util.TraceOutputStream.write(TraceOutputStream.java:116)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.flush(Unknown Source)
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:2429)
Caused: javax.mail.MessagingException: Can't send command to SMTP host;
nested exception is:
java.net.SocketException: Connection closed by remote host
I have added “-Djava.awt.headless=true -Dmail.smtp.starttls.enable=true” in jenkins.xml arguments section and restarted the jenkins.
Extended E-mail Notification Settings:
SMTP Server: smtp.office365.com
SMTP Port: 25 [tried with 587]
Use SSL: no
Use TSL: yes
Charset UTF-8
Same setting used under “E-mail Notification” settings as well
So can’t really help much on the jenkins side, thats just a generic “couldn’t make the connection” or more likely “other server closed the connection” error.
That being said, since you mentioned office365, I know they have a local binary you can run so you smtp to that localhost, then it submits to office365 via api. It apparently works a lot better.