Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

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):

    &lt;#include &quot;include/header.ftl&quot;&gt;
    &lt;@subject message=message/&gt;
    
    &lt;span class="copySmall"&gt;&lt;@fmt key=&quot;ftl.automatedEmail&quot;/&gt;&lt;/span&gt;<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:

    &lt;@subject value=&quot;My custom subject&quot;/&gt;
    

    ... or make it translatable:

    &lt;@subject key=&quot;translations.file.key&quot;/&gt;
    

    ... 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:

    1. How can I add the alarm level to the message subject?
    2. Why not make this the default email subject (more intuitive and convenient) in the next release?
    3. Does changing a file under ftl/ require a Mango restart?
    4. 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 **

    &lt;#--
        Copyright (C) 2006-2011 Serotonin Software Technologies Inc. All rights reserved.
        @author Matthew Lohbihler
    --&gt;
    &lt;#include &quot;include/eventHeader.ftl&quot;&gt;
    &lt;@subject message=message/&gt;
    &lt;table&gt;
      &lt;tr&gt;&lt;td colspan="3" class="smallTitle"&gt;${instanceDescription} - &lt;@fmt key=&quot;ftl.eventActive&quot;/&gt;&lt;/td&gt;&lt;/tr&gt;
      &lt;#include &quot;include/eventData.ftl&quot;&gt;
      &lt;#include &quot;include/eventMessage.ftl&quot;&gt;
    &lt;/table&gt;
    &lt;#include &quot;include/eventFooter.ftl&quot;&gt;
    

    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