Problem

  • The static e-mail configuration in factory.ini is not sufficient
  • A different user should receive a mail according to the severity level of the message

Solution

  • see "How to configure an e-mail service" to change the JobScheduler configuration if necessary.
  • Change the sytelsheet for JobScheduler e-mail service to define different recipients for different severity levels as shown below:

    <?xml version='1.0' encoding='iso-8859-1' ?>
    <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version   = "1.0">
        
       <xsl:param name="lang" select="'en'"/> 
        
       <xsl:variable name="job"  select="/scheduler_event/state/jobs/job[ @job = /scheduler_event/@job ]" />
       <xsl:variable name="task" select="$job/tasks/task[ @task = /scheduler_event/@task ]" />
    
       <xsl:template match="/scheduler_event">
          ...
          <xsl:choose>
             <xsl:when test="@severity='info'">
                <xsl:attribute name="to"><xsl:value-of select="'admin@mail.com'" /></xsl:attribute>
             </xsl:when>
             <xsl:when test="@severity='warning'">
                <xsl:attribute name="to"><xsl:value-of select="'admin@mail.com'" /></xsl:attribute>
             </xsl:when>
             <xsl:when test="@severity='error'">
                <xsl:attribute name="to"><xsl:value-of select="'admin@mail.com,boss@mail.com'" /></xsl:attribute>
             </xsl:when>
             <xsl:when test="@severity='fatal'">
                <xsl:attribute name="to"><xsl:value-of select="'admin@mail.com,boss@mail.com'" /></xsl:attribute>
             </xsl:when>
             <xsl:otherwise>
                <xsl:copy-of select="mail/header/@to" />
                <xsl:copy-of select="mail/header/@cc" />
                <xsl:copy-of select="mail/header/@bcc" />
             </xsl:otherwise>
          </xsl:choose>
          ...
       </xsl:template>
    
    </xsl:stylesheet>