28.07.2020, 10:57
I'm using script like this and it works even if one of the emails are empty.
Code:
alarm = grp.getvalue('10/0/31')
email1 = grp.getvalue('32/6/1')
email2 = grp.getvalue('32/6/2')
email3 = grp.getvalue('32/6/3')
if email1~='' then
if email2~='' then
if email3~='' then
emails = {email1,email2,email3}
else
emails = {email1,email2}
end
else
emails = {email1}
end
else
if email2~='' then
if email3~='' then
emails = {email2,email3}
else
emails = {email2}
end
else
if email3~='' then
emails = {email3}
end
end
end
if alarm then
mail(emails, 'MAJA valvekeskuse alarm', 'Tere! <br><br>Valvekeskuse poolt on tuvastatud MAJA häire! Palun vaadake täpsemalt visualiseeringust.<br><br><br><i>See email on genereeritud automaatikasüsteemi poolt. Palun mitte sellele emailile vastata!')
end