Customizing event emails to display alarm level and message in subject field
-
How can I get the event email message subject to show the "alarm level" and "event message" (or event alias) rather than the id number?
By message, I'm referring to whatever text is displayed on the Alarms page Message field:Pending alarms
Acknowledge all Acknowledge all Silence all Silence all
Id Alarm level Time Message Inactive time
The problem is that all the subjects of emails sent via "User Details / Send alarm emails" currently look the same:
Mango event active notification - id:<some_number>
This is not informative, and I must open each email to find out what event occurred and what is the severity. It's too tedious to create an email event handler each time I add an event detector to a point; I would like the "Send alarm emails" setting in "User Details" to send the event "Alarm level" and "Message" in the subject field by default.I already copied
/opt/mango/classes/i18n.properties to /opt/mango/overrides/properties/i18n.properties, but it is not obvious how I should change line 277-283.ftl.subject.default=Mango event {0} notification ftl.subject.default.id=Mango event {0} notification - id:{1} ftl.subject.alias={0} ({1}) ftl.subject.alias.id={0} ({1}) - id:{2} ftl.subject.active=active ftl.subject.escalation=escalation ftl.subject.inactive=inactive
Thanks.
-
You can modify the ftl files to do this. For example, in ftl/html/testEmail.ftl i can add a line with a "subject" directive (the second line):
<#include "include/header.ftl"> <@subject message=message/> <span class="copySmall"><@fmt key="ftl.automatedEmail"/></span><br/>
This makes the subject line of the email the same as the message that is displayed in the body. I could also set a custom subject:
<@subject value="My custom subject"/>
... or make it translatable:
<@subject key="translations.file.key"/>
... and then in the translations files add "translations.file.key=My translated custom subject".
The next core release will allow ftl files to be put into the overrides directory.
-
Great, thanks. I edited that file, now I just have to wait for alert emails to confirm that it works. Quick questions:
- How can I add the alarm level to the message subject?
- Why not make this the default email subject (more intuitive and convenient) in the next release?
- Does changing a file under ftl/ require a Mango restart?
- The greatest part of Mango is the context-sensitive help. Where will I find email customization instructions in the help?
It would be nice if there were a help search feature.
If you think email customization would clutter the help, then your help could be a one-liner:
"To customize the help, read <MANGO_DIR>/ftl/html/README"Thanks again.
-
I added the message directive as you suggested (line 6 below), but now all the email subject heading I receive are blank.
/opt/mango/ftl/html$ **cat active.ftl **
<#-- Copyright (C) 2006-2011 Serotonin Software Technologies Inc. All rights reserved. @author Matthew Lohbihler --> <#include "include/eventHeader.ftl"> <@subject message=message/> <table> <tr><td colspan="3" class="smallTitle">${instanceDescription} - <@fmt key="ftl.eventActive"/></td></tr> <#include "include/eventData.ftl"> <#include "include/eventMessage.ftl"> </table> <#include "include/eventFooter.ftl">
Can you please paste a tested 'active.ftl' file that adds both the alarm level and the message to the subject field?
How do you feel about making that the default subject heading template for 2.0.4?
Thanks