Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Title style corrected

...

The JITL jobs JSSmtpMailClientAdapter and SmtpMailMonitor are included since JobScheduler Release 1.5.3253.
These job is now without a documentation. It is useful for sending emails.
It contains all parameters like the JobSchedulerManagedMailJob.

SmtpMailMonitor

SmtpMailMonitor can used for a pre- or post-processing.

...

For each prefix you can specify e.g. different recipients.

Example for prefix MailOnSuccess_

You want that a job should sends a mail in the case of an error in the normal way via the JobScheduler mail notification.
This mail has the task log as attachment.
Further you want a success mail but without the task log, so deactivate the mail via JobScheduler (see <settings> in the following example) and
specify some parameter with the "MailOnSuccess_" prefix.

Code Block
languagehtml/xml
<job>
  <settings>
    <mail_on_error><![CDATA[yes]]></mail_on_error>
    <mail_on_warning><![CDATA[yes]]></mail_on_warning>
    <mail_on_success><![CDATA[no]]></mail_on_success>
  </settings>
  <params>
    <param name="host" value="my_smtp"/>
    <param name="MailOnSuccess_to" value="mymail@address.com"/>
    <param name="MailOnSuccess_body" value="%SCHEDULER_JOB_NAME% has run successfully"/>
    <param name="MailOnSuccess_subject" value="%SCHEDULER_JOB_NAME% has run successfully"/>
  </params>
  <script language="shell">
    <![CDATA[       
exit 0       
    ]]>
  </script>
  <monitor name="process0" ordering="0">
    <script java_class="com.sos.jitl.mail.smtp.SmtpMailMonitor" java_class_path="" language="java"/>
  </monitor>
  <run_time/>
</job>

JSSmtpMailClientAdapter

Example job using com.sos.jitl.mail.smtp.JSSmtpMailClientAdapterClass:

Code Block
languagehtml/xml
<job>
  <params>
    <param name="subject" value="Test-Mail"/>
    <param name="body" value="This is the body"/>
    <param name="to" value="myMail@address.com"/>
    <param name="host" value="my_smtp"/>
  </params>
  <script  language="java" java_class="com.sos.jitl.mail.smtp.JSSmtpMailClientAdapterClass"/>
  <run_time/>
</job>

Example for substitute parameters

The can substitute its parameters with other parameters.
We assume that we have a job chain with two jobs. The first job transfers files and if the first job has an error than the seconds job starts to send an email. Otherwise the job chain ends after the first job. The body of the email should have the error of the first job.
The first job writes its last error in a post-processing into the order parameter with the name last_error and the mail job has a parameter

...