Sending Reports By Email Issue

Hi everyone.

I am trying to send Reports Via emails but when i setup the SMTP profile i am not able to send emails and i get the error attached every time.

Thank you in advance for your help,

Is your gateway able to connect to the internet? Is there a firewall blocking connections to

Hi, yes my gateway is connected to internet and i am able to ping successuly :

you can, or can you do that from a terminal running on the same server as the gateway?

Regardless, you have a networking problem to solve, not a configuration issue in Ignition.

Trying to find other examples of SMTP connections to outlook - might try variations of those StartTLS / SSL settings in the meantime.

Thak you Kevin ,I pinged from the same server as the gateway , and i even desabled the firwall ,

Having the same issue. Can ping from server, can send test email from gateway, but script "", sender, email_subject, email_body, 1, email_to, [fileName], [fileData]) does not work.

What does "does not work" mean and look like?

1 Like

Traceback (most recent call last):
File "input", line 29, in module
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendEmail(
at com.inductiveautomation.ignition.client.script.ClientNetUtilities._sendEmail(
at com.inductiveautomation.ignition.common.script.builtin.AbstractNetUtilities.sendEmail(
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Error sending email. Session id=57D42CCC

Is there a certain format for the smtp string in the sendEmail command if STARTTLS is used?

To clarify, I can send a test email from the gateway so I know there is communication out. However, when I put the hostname "" or "" in the actual script, it fails with that error.

If you specify the host as$port:tls, where $port is the actual port, it will use TLS and automatically try to use StartTLS.

This particular way of using sendEmail is deprecated though. Set up an email profile in the gateway and reference that in the arguments instead.

Is there more to that error, or a corresponding error in the gateway logs?

check out the last code example that uses keyword args to send by profile.

That worked mostly, but the attachments still error out. What are the keys for the pairs for attachments?

And thank you!

Docs suggest attachmentNames and attachmentData

1 Like

Thank you, I saw those in the brackets and assumed that it was meant as the value and not the key name.

This did it! Thanks for your help!