javax.mail.MessagingException: Could not convert socket to TLS;


System generates sporadically error when send email through scheduler.


ERROR - Unexpected exception caught while trying to send an email message with sender ID of XXXXXXXXXXX

javax.mail.MessagingException: Could not convert socket to TLS;
nested exception is: Remote host closed connection during handshake
at com.sun.mail.smtp.SMTPTransport.startTLS(
at com.sun.mail.smtp.SMTPTransport.protocolConnect(
at javax.mail.Service.connect(
at javax.mail.Service.connect(
at com.pegarules.generated.SendEmailMessage_071025_BlRMk6UdYGJBle4Q9qA_kg.SendEmailMessage07_10_25(
at com.pegarules.generated.SendEmailMessage_071025_BlRMk6UdYGJBle4Q9qA_kg.invoke(
at com.pega.pegarules.generation.internal.library.LibraryRuntime.resolveAndinvokeFunctionViaReflection(
at com.pega.pegarules.generation.internal.library.LibraryRuntime.invokeLibraryRuntime(
at com.pega.pegarules.session.internal.mgmt.Executable.invokeLibraryRuntime(
at com.pega.pegarules.priv.generator.LibrarySupport.resolveAndInvokeFunctionViaReflectionWithException(
at java.lang.invoke.DirectHandle.invokeExact_thunkArchetype_L(
at java.lang.invoke.BruteArgumentMoverHandle.invokeExact_thunkArchetype_X(
at java.lang.invoke.CollectHandle.invokeExact_thunkArchetype_X(
at java.lang.invoke.FilterReturnHandle.invokeExact_thunkArchetype_X(
at java.lang.invoke.AsTypeHandle.invokeExact_thunkArchetype_X(
at com.pegarules.generated.activity.ra_action_sendemailnotification_71749bf75123085c922415ea17ed816b$$dtt.dt_62_step6_circum0_357(Unknown Source)
at com.pegarules.generated.activity.ra_action_sendemailnotification_71749bf75123085c922415ea17ed816b.step6_circum0(

Correct Answer
November 12, 2018 - 11:21pm

Try bypassing TLS by setting/creating DSS  in your environment

Owning Ruleset = Pega-IntSvcs  Purpose = Email/DisableSecuritySTARTTLS  Value = true




Keep up to date on this post and subscribe to comments

December 26, 2017 - 9:15am

From the log we could see SSLHandshakeException: Remote host closed connection during handshake. This means that there is some network issue. That is why you face this issue sporadically.

You can get more information on the following:

December 26, 2017 - 10:40am


Can you provide the below details.

App server and version
Java version
Email Account record information... at least:
What host are they connecting to? Exchange / Gmail / etc
what port are they using?
Is the listener running frequently?
Is the listener running on more than one server/node?
Is the email provider  using load balancing?

Can you also check JRE version used by app server and JRE version which email listener is using.

December 26, 2017 - 12:30pm

Log says connectivity issue between Pega server and email server. If your using exchange server then register Pega server ipaddress in email server.

December 26, 2017 - 3:54pm

From the stacktrace looks like a JRE mismatch from the outset .

However add following JVM argument which will log all SSL related interaction over the network  in the server logs  .



November 12, 2018 - 11:21pm

Try bypassing TLS by setting/creating DSS  in your environment

Owning Ruleset = Pega-IntSvcs  Purpose = Email/DisableSecuritySTARTTLS  Value = true



August 28, 2019 - 6:31am
Response to hyana1

Thanks Anupam.. Worked for me

March 7, 2019 - 8:03am


Awesome, your suggestion fixed it for me. Thanks!


August 28, 2019 - 11:11am

Thanks @Dhivya2b20 & @Marco Looy for letting us know that @hyana1's reply was the correct answer!

I have marked it as such to let others know who may be having the same question.

Marissa | Community Moderator | Pegasystems Inc.