Hi everyone,
I am using an Ignition Alarm Pipeline and want to send email notifications using the Notify block.
The roster is built dynamically by a script:
logger = system.util.getLogger("sendMail")
recievers = system.tag.readBlocking("[internal]Services/email/recievers")[0].value
roster = []
for r in recievers:
if isValidEmail(r["email"]):
temp = { "username": r["username"], "email": [r["email"]] }
roster.append(temp)
else:
logger.info(u"E-Mail: %s is not valid and will be ignored" % r["email"])
logger.debug("Send to: %s" % system.util.jsonEncode(roster))
return roster
import re
def isValidEmail(email):
if email is None:
return False
email = email.strip()
pattern = r'^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$'
return re.match(pattern, email) is not None
The resulting roster looks like this:
[
{
"email": ["xxx@xx.com"],
"username": "User1"
},
{
"email": ["xxx@xxx.com"],
"username": "User2"
}
]
When I set the Notify block to Test Mode, the logs indicate that an email would be sent to both users.
However, when I disable Test Mode, only the first user in the roster actually receives an email. If I swap the order of the users in the roster array, then the other user receives the email instead. So it always seems to send only to the first entry.
I have also tried adding debug logs to find any errors, but there are no error messages or warnings in the logs.
Has anyone seen this behavior before, or does anyone have an idea what could cause the Notify block to only send to the first roster entry when Test Mode is disabled?
Thanks in advance!