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

Compare with Current View Page History

Version 1 Next »

h1. How to change the "from address" of an eMail sent by JobScheduler

The "from address" which is used by JobScheduler in case of sending a mail is customized in configuration.
This address is used in general for all mails.

If one want to use an adress depending on the job or the order the address has to be changed by using the "internal API" of the JobScheduler and by
put some code into a "preprocessing" script.

The address itself can be a string constant or can be defined by job- or order-parameters used in the job.

Example

The job used as an example will execute a short shell script and then exit with exit-code 5.
The coding used in the preprocessing routine "spooler_process_before" modifies for this job the "from address" to "ab@xyz-dom.com". The modification is effective for this job only.

    <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/job.xml job ]name="job8">
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/script.xml script ]language="shell">
        <![CDATA[
        echo process
        exit 5
                ]]>
        </script>
    <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/monitor.xml monitor ]name="process0"
                 ordering="0">
        <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/script.xml script ]language="javascript">
            <![CDATA[
                function spooler_process_before() \{
                    spooler_log.mail.from = "ab@xyz-dom.com";
                    spooler_log.info('some log entry ....');
                    return true;
                \}
                ]]>
    </script>
      </monitor>
      <[http://www.sos-berlin.com/doc/en/scheduler.doc/xml/run_time.xml run_time]/>
    </job>

related downloads

n.a.

see also

n.a.

  • No labels