JavaMail Issue: Can't send command to SMTP host

Viewed 381

I'm trying to send a mail via Talend ETL tools (using Java code), sometimes the mail get trigger successfully, but very often it bumps into the error below.

StartTLS has been enabled, this inconsistent issue has only start to appear 1 month ago

We have tried to check with the SMTP provider but still not able to troubleshoot.

Any suggestion will be appreciated, thanks!

Exception in component tSendMail_1 (SMTP_PY)
javax.mail.MessagingException: Can't send command to SMTP host;
  nested exception is:
    javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
    at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1420)
    at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1408)
    at com.sun.mail.smtp.SMTPTransport.ehlo(SMTPTransport.java:847)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:384)
    at javax.mail.Service.connect(Service.java:297)
    at javax.mail.Service.connect(Service.java:156)
    at javax.mail.Service.connect(Service.java:105)
    at javax.mail.Transport.send0(Transport.java:168)
    at javax.mail.Transport.send(Transport.java:98)
    at smtp_job.smtp_py_0_1.SMTP_PY.tSendMail_1Process(SMTP_PY.java:434)
    at smtp_job.smtp_py_0_1.SMTP_PY.runJobInTOS(SMTP_PY.java:718)
    at smtp_job.smtp_py_0_1.SMTP_PY.main(SMTP_PY.java:567)
Caused by: javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake
    at java.base/sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1058)
    at java.base/sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
    at java.base/sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1402)
    at java.base/sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:733)
    at java.base/sun.security.ssl.AppOutputStream.write(AppOutputStream.java:67)
    at com.sun.mail.util.TraceOutputStream.write(TraceOutputStream.java:101)
    at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
    at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
    at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1418)
    ... 11 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
    at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:156)
    at java.base/sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1031)
    ... 19 more
0 Answers
Related