Emailing Alarms to Multiple Addresses

Hello I have a string tag in the PLC setup with “email1@domain.com,email2@domain.com”. I would like to map that to the “Email To” Section of the “Alarm Email Upon” tag configuration. I have multiple tags coming into the PLC for various areas of the plant. Each Area will have it’s own “Email To” addresses set up from a different string tag in the PLC. Is this possible?

I apologize. I should have said each tag alarm will have it’s own “Email To” list of addresses.

Hi DDowling,

Using the Basic IDE, it’s possible to edit tag parameters like the “Email To” setting. You can also pull data from other tags, so what you’re suggesting is fairly straightforward. You’ll need to handle the logic to make sure the right email address tags are applied to the right alarm tags, but here’s an example where the tag AlarmBit has its “Email To” set to the value of the tag EmailTo whenever EmailTo changes:

ONCHANGE "EmailTo", "@UpdateEmail()"

FUNCTION UpdateEmail():
  SETSYS TAG, "load", "AlarmBit"
  SETSYS TAG, "ETO", EmailTo@
  SETSYS TAG, "save"
  CFGSAVE
ENDFN

Okay great.

So currently I have a tag being read from the PLC called “Process1Down”. It is set to Alarm upon a value of 1. When it goes into alarm it is set to email upon alarm. It’s all tested and working when I enter a static address into the “Email to” section. I also have another string tag written from the processor labeled “Process1DownEmailList”. What pieces of your code do I need to change to “Process1DownEmailList” to load into the “Email to” section when “Process1Down” tag goes into alarm?

Then the same would apply for when a tag labeled “Process2Down” tag goes into alarm. When “Process2Down” goes into alarm I only want the string tag “Process2DownEmailList” recipients to receive the email. So basically each Alarm Tag will have its own set of email recipients.

I don’t know if updating the email when the tag goes into alarm will work, since I’m not sure how quickly the change will be processed and therefore if it will apply before the alarm email is sent. The code I shared uses ONCHANGE to monitor the tag EmailTo for changes, then runs the update code whenever it does.

You would need to update the parts of my code that say EmailTo to the tag containing the email list, and the part that says AlarmBit to the tag that has the alarm on it.