You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Problem (Example)

  • the static mail configuration in factory.ini is not sufficient
  • different user must receive a mail according to the severity level of the message

Solution

It is possible to configure a xslt stylesheet to manipulate the properties of the e-mail in scheduler.xml:
<spooler>

  <config '''mail_xslt_stylesheet''' = "config/scheduler_mail.xsl" port = "4050">
    ...
  </config>

</code>
config/scheduler_mail.xsl is the default stylesheet for mail transformation and was shipped with the standard installation.

You can change this sytelsheet to define different recipients for different severity levels as shown below:
<?xml versioh1. '1.0' encoding'iso-8859-1' ?>
<xsl:stylesheet xmlns:xslh1. "http://www.w3.org/1999/XSL/Transform" version "1.0">

   <xsl:variable name="lang" select="de"/> 
    
   <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='fatal'">
            <xsl:attribute name="to"><xsl:value-of select="'admin@mail.com'" /></xsl:attribute>
            <xsl:attribute name="to"><xsl:value-of select="'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>

  • No labels