Skip to end of metadata
Go to start of metadata

General Mail Settings in the ./config/factory.ini

The general mail settings are made during the JobScheduler Setup. These are stored in the ./config/factory.ini file.
These settings apply to all jobs, but this can be overridden in the job configuration.

In the section [spooler] you have entries for the email addresses of the sender and recipients (incl. cc and bcc). Use a comma to separate multiple email addresses.

 log_mail_from	         = 
 log_mail_to	         = 
 log_mail_cc	         = 
 log_mail_bcc	         = 

Further you must set the SMTP server

 smtp	                 = 

The following entries control when a email will be sent.

 ;                         send mail with job log in case of error (yes|no, default: no)
 mail_on_error           = yes
 ;                         send mail with job log in case of errors and warnings (yes|no, default: no); only for api jobs
 mail_on_warning         = yes
 ;                         send mail with job log in case of success (yes|no, default: no)
 mail_on_success         = no
 ;                         send mail with job log in case of process steps (yes|no|1|2|n, default: no); only for standalone api jobs
 mail_on_process         = no

In a section [smtp] you can set an email account if necessary

 mail.smtp.user          =
 mail.smtp.password      =
 mail.smtp.port          = 25

Look at the table here for more java mail properties.

Look here for more information about the factory.ini.

Mail Settings in the Job Configuration

When you configure a Job in JOE (JobScheduler Object Editor) then you have the Job displayed in the left tree view.
Open the Job and then open the Job Settings.

Mail Settings in the Job Chain Configuration

Mail settings are only configurable for a Job.

We assume that you have a Job Chain with multiple Order-Jobs in the following structure.
Whenever a Job in the Job Chain has an error then the Order goes to the End Node 'error'.
Otherwise the Order goes to the next Job and finally in the End Node 'success'.

If you have set mail_on_error = yes in the ./config/factory.ini (recommended), then you get max. one error mail per Job Chain Order.

If you have set mail_on_success = yes in the ./config/factory.ini, then you get a success mail for each Job in the Job Chain per Order.

If you have set mail_on_success = no in the ./config/factory.ini (recommended), then you get no success mail for each Job Chain per Order.

If you want exactly one 'success' mail per Job Chain Order then configure all Jobs except the last Job with mail_on_success = no.

We recommend that you create a new Order-Job which is called e.g. /lastJobChainJob. This Order-Job is the only Order-Job which has the mail_on_success = yes setting.

All other Order-Jobs should have mail_on_success = no.

You insert this Order-Job /lastJobChainJob to all Job Chains as the last Job.

The Job /lastJobChainJob can use the internal API to modify the mail subject in the following form:

 <?xml version="1.0" encoding="ISO-8859-1"?>
 
 
 <job order="yes" stop_on_error="no">
     <settings>
         <mail_on_success><![CDATA[yes]]></mail_on_success>
     </settings> 
 
     <script language="javascript">
         <![CDATA[
 function spooler_process() { 
  
 	spooler_log.mail.subject = "job chain '" + spooler_task.order.job_chain.name() + "' has successfully finished";
 	return true;
 }
         ]]>
     </script>
 
     <run_time />
 </job>
Write a comment…