03.10.2022, 09:24
I've tried to re-create this issue and it seems that the message source won't be helpful here.
Try this reworked script with extra line breaks and see if it helps.
Try this reworked script with extra line breaks and see if it helps.
Code:
value = event.getvalue()
require('user.sendmail')
require('user.emails')
header_alarm = 'Tere! <br><br> <b>SV1</b> automaatikasüsteemis on tuvastatud järgmised häired: <br><br>'
header_ok = 'Tere! <br><br> <b>SV1</b> automaatikasüsteemi häired on taastunud ning süsteem on töökorras.<br><br>Kokkuvõte häiretest: <br><br>'
footer = '<br><br><br><br><i>Email on genereeritud automaatikasüsteemi poolt. Palume mitte sellele emailile vastata!<br><br>Parimate soovidega,<br>Building Automation System OÜ</i>'
text_alarm = ' - <span style="color:red;font-weight:bold">ALARM!</span><br>'
text_ok = ' - <span style="color:green;font-weight:bold">OK</span><br>'
buf = {}
buf[ #buf + 1 ] = value > 0 and header_alarm or header_ok
alarms = grp.tag('SV1-ALARMS')
for _, alarm in ipairs(alarms) do
buf[ #buf + 1 ] = alarm.name
buf[ #buf + 1 ] = alarm.value and text_alarm or text_ok
end
buf[ #buf + 1 ] = footer
message = table.concat(buf, '\n')
res, err = mail(emails, 'Hooneautomaatika', message)
grp.checkupdate('38/4/6', err ~= nil)