# Java TLS Error When sending e-mail

**URL:** <https://forum.inductiveautomation.com/t/java-tls-error-when-sending-e-mail/14168>\
**Category:** General Discussion\
**Created:** [April 28, 2017, 8:30pm UTC](https://forum.inductiveautomation.com/t/java-tls-error-when-sending-e-mail/14168 "2017-04-28T20:30:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dohertab](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@Dohertab](https://forum.inductiveautomation.com/u/Dohertab)\
**Post date:** [April 28, 2017, 8:30pm UTC](https://forum.inductiveautomation.com/t/java-tls-error-when-sending-e-mail/14168/1 "2017-04-28T20:30:11Z")

</div>

When attempting to use the ‘system.net.sendEmail’ function, I get the following error:

"Traceback (most recent call last):  
File “event:actionPerformed”, line 37, in

com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: Error sending email.  
caused by GatewayException: Error sending email.  
caused by javax.mail.MessagingException: Could not convert socket to TLS;  
nested exception is:  
javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

Ignition v7.8.2 (b2016030813)  
Java: Oracle Corporation 1.8.0\_131"

Emailing was working fine for weeks, and then this appeared out of the blue. Any idea what’s going on?

Thanks.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 28, 2017, 8:50pm UTC](https://forum.inductiveautomation.com/t/java-tls-error-when-sending-e-mail/14168/2 "2017-04-28T20:50:25Z")

</div>

It looks like what changed was that the latest version of Java was installed.

This error means that you’re trying to send email with SSL/TLS enabled and the certificate being presented by your mail server can’t be validated (i.e. it is not signed by a valid CA certificate).

Your quickest fix would be to send without SSL/TLS for now, if that’s possible. Then you can deal with getting the certificate situation sorted out. Is this an internal server or something like office 365 on the internet?

---

<div class="post-metadata">

**Author:** ![Dohertab](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@Dohertab](https://forum.inductiveautomation.com/u/Dohertab)\
**Post date:** [May 1, 2017, 3:49pm UTC](https://forum.inductiveautomation.com/t/java-tls-error-when-sending-e-mail/14168/3 "2017-05-01T15:49:04Z")

</div>

Thanks for the response Kevin! Yeah this is Office 365 on the cloud, I have to go through a 3rd party IT company in making any changes. After trying to send without TLS, I am denied permissions. Is it tough to get the certificate situation sorted out? Will research that now.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 1, 2017, 4:23pm UTC](https://forum.inductiveautomation.com/t/java-tls-error-when-sending-e-mail/14168/4 "2017-05-01T16:23:04Z")

</div>

Hmm. It’s hard to imagine the CA cert used to sign the Office 365 cert isn’t already in the Java’s trusted cacerts list…

Is it possible the network you’re on has some kind of “security” appliance that MITMs all traffic, including SSL/TLS? This would cause the certificate seen by Java to be the one belonging to the appliance instead of the Office 365 certificate. While not as common, this _is_ something we’ve seen in the past.

---

<div class="post-metadata">

**Author:** ![Dohertab](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@Dohertab](https://forum.inductiveautomation.com/u/Dohertab)\
**Post date:** [May 1, 2017, 5:04pm UTC](https://forum.inductiveautomation.com/t/java-tls-error-when-sending-e-mail/14168/5 "2017-05-01T17:04:02Z")

</div>

Great question! I’ll get on the phone with their IT and investigate that.

---

<div class="post-metadata">

**Author:** ![Dohertab](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@Dohertab](https://forum.inductiveautomation.com/u/Dohertab)\
**Post date:** [May 8, 2017, 7:50pm UTC](https://forum.inductiveautomation.com/t/java-tls-error-when-sending-e-mail/14168/6 "2017-05-08T19:50:21Z")

</div>

Figured out the issue. Not sure how this problem came to be, although I’m pretty confident it did have something to do with Java upgrading.

Following the ‘Installing JAVA\_HOME on Windows’ instructions in the following link fixed the problem:

[https://confluence.atlassian.com/adminjiraserver073/installing-java-861253016.html#InstallingJava-2.SettingJAVA\_HOME](https://confluence.atlassian.com/adminjiraserver073/installing-java-861253016.html#InstallingJava-2.SettingJAVA_HOME)

Also had to restart the gateway in order for the change to take effect. Hope this helps somebody else.
