Sending email via memory bit trigger

Hello all,

I wonder, is there any way sending email in the script of tags? I looked the manual and some topics, almost all of them related to gateway or another section in the ignition. I couldn’t find out any example inside the tags scripts.

For example;
image

I have a memory tag as above and it has some script codes for get data from MES system. It’s working for now, but I have some if&else condition into this script of tag and I want to send email if run my “else” condition and give detail information about process.

Is it possible this? Can I manage this directly over memory tag?

Edit:
When I try this script in the console, I get error as following.

body = "Hello, this is an email."
recipients = ["test1@gmail.com"]
system.net.sendEmail("mail.mycompany.com",
 "myemail@mycompany.com", "Here is the email!", body, 0, recipients)```

Output

com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Error sending email. Session id=BB58AF7B

Thanks

You’ll need a valid smtp server and emails configured.
With that done, this should work as expected. I’m using this function to send mails and it works fine.

1 Like

Ok, I understood. I’ll check my SMTP configuration. Thanks!