you can define a monitor for a specific job which sends emails in case of

  • error
    success
  • job start

Please add the monitor as a pre/postprocessing to the job. The language is java and the class is com.sos.jitl.mail.smtp.SmtpMailMonitor

Please define the required parameters

  • The email on error will be sent when the paramteter MailOnError_to is set
  • The email on success will be sent when the paramteter MailOnSuccess_to is set
  • The email on job start will be sent when the paramteter MailOnJobStart_to is set

When you have a html body for your email, you must specify the parameter MailOnJobStart_content_type=text/html

An example job configuration with a html body

        <job  title="Dies ist der Titel des Jobs" stop_on_error="no" order="yes" name="email_monitor">
            <settings >
                <log_level ><![CDATA[debug9]]></log_level>
            </settings>
  
            <params >
                <param  name="host" value="smtp.sos"/>
                <param  name="port" value="25"/>
                <param  name="from" value="scheduler@ur"/>
                <param  name="MailOnJobStart_to" value="uwe.risse@sos-berlin.com"/>
                <param  name="MailOnJobStart_subject" value="Job: %{SCHEDULER_JOB_NAME}  Task: %{SCHEDULER_TASK_ID}"/>
                <param  name="MailOnJobStart_body" value="<html>   <head>      <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">     <title></title>   </head>   <body text="#000000" bgcolor="#FFFFFF">     <b>Scheduler ID:</b> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;     %{SCHEDULER_ID}<br>     <b>Scheduler</b>:&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;     %{SCHEDULER_HOST}:%{SCHEDULER_TCP_PORT}<br>     <b>Configuration in:</b> &nbsp;&nbsp;&nbsp;     %{SCHEDULER_CONFIGURATION_DIRECTORY}<br>     <br>     <b>Task:</b> %{SCHEDULER_TASK_ID}<br>     <b>Job: &nbsp; </b>%{SCHEDULER_JOB_NAME}&nbsp; &nbsp;&nbsp;&nbsp; <br>     %{SCHEDULER_JOB_TITLE}<br>     <br>     <b>Job_chain:</b>&nbsp; %{SCHEDULER_JOB_CHAIN_NAME}<br>     %{SCHEDULER_JOB_CHAIN_TITLE}<br>     <br>     <b>Order</b>:&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp; %{SCHEDULER_ORDER_ID}<br>     <b>in Node:</b>&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;     %{SCHEDULER_NODE_NAME}<br>     <b>next Node:</b> &nbsp;&nbsp;&nbsp; %{SCHEDULER_NEXT_NODE_NAME}<br>     <br>     <font color="#999999" face="Calibri"><small><small><font size="-1"><small><small></small></small></font></small></small></font>     <div class="moz-signature"> </div>   </body> </html> "/>
                <param  name="MailOnJobStart_content_type" value="text/html"/>
                <param  name="MailOnError_to" value="uwe.risse@sos-berlin.com"/>
                <param  name="MailOnError_subject" value="An error occurred in Job: %{SCHEDULER_JOB_NAME}  Task: %{SCHEDULER_TASK_ID}"/>
                <param  name="MailOnError_content_type" value="text/html"/>
                <param  name="MailOnError_body" value="<html>   <head>      <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">      <title></title>   </head>   <body text="#000000" bgcolor="#FFFFFF">     <b>Scheduler ID:</b> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;     %{SCHEDULER_ID}<br>     <b>Scheduler</b>:&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;     %{SCHEDULER_HOST}:%{SCHEDULER_TCP_PORT}<br>     <b>Configuration in:</b> &nbsp;&nbsp;&nbsp;     %{SCHEDULER_CONFIGURATION_DIRECTORY}<br>     <br>     <b>Task:</b> %{SCHEDULER_TASK_ID}<br>     <b>Job: &nbsp; </b>%{SCHEDULER_JOB_NAME}&nbsp; &nbsp;&nbsp;&nbsp; <br>     %{SCHEDULER_JOB_TITLE}<br>     <br>     <b>Job_chain:</b>&nbsp; %{SCHEDULER_JOB_CHAIN_NAME}<br>     %{SCHEDULER_JOB_CHAIN_TITLE}<br>     <br>     <b>Order</b>:&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;     &nbsp;&nbsp;&nbsp; %{SCHEDULER_ORDER_ID}<br>     <b>in Node:</b>&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;     %{SCHEDULER_NODE_NAME}<br>     <b>next Node:</b> &nbsp;&nbsp;&nbsp; %{SCHEDULER_NEXT_NODE_NAME}<br>     <br>     <font color="#999999" face="Calibri"><small><small><font size="-1"><small><small></small></small></font></small></small></font>     <div class="moz-signature"> </div>   </body> </html> "/>
            </params>
 
            <script  language="shell">
                <![CDATA[
 dir
 exit 1
                ]]>
            </script>
 
            <monitor  name="process0" ordering="0">
                <script  language="java" java_class="com.sos.jitl.mail.smtp.SmtpMailMonitor"/>
            </monitor>
 
            <run_time />
        </job>