Email Report Using Gateway Script

system.report.executeAndDistribute(path=“General Plant/Site Security/Visitor Dwell Time”, project=“JMC_Process”, action= “email”,

actionSettings = {“to”:[“dweber@smithfield.com”], “smtpServerName”:“Smtp.mysmithfield.com”, “from”:"IgnitionDoNotReply@smithfield.com", “subject”:“Visitor Duration Report”})

I can not send an email running this expression on a button. I am not receiving any errors. The auto generated email works on the schedule section of the report. We are trying to trigger a gateway script that sends the report in an email when triggered.

You are checking for errors in the Gateway console, not the Designer, right? And the smtpServerName you’re using is the name you gave it when you set it up in the Gateway, not the actual name of your server?

If both of those are ‘yes’, try turning the SMTP.Manager logger to Debug in the Gateway. This will let you know if the message is getting to Ignition’s mail system or not.

I did not have the name of the SMTP server the same as what I named it in ignition gateway. Thank You!

For future users who stumble onto this thread, another good debugging practice is wrapping this in a try-except. Things like missing/bad profile names, missing recipients, and Java mail exceptions will show up that way and be easier to diagnose. All the distribution methods can throw an IllegalArgumentException, but mail can also throw SendFailedException and MessagingException.

Hello Kathy, can you provide a try-except example for emailing a report via tag change? My report will not print out with shared or project scripts, client or Gateway. Thanks!