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

Compare with Current View Page History

« Previous Version 7 Next »

First see here how to make an "Action Config to run one instance of a task". This couples a log event code to an action config. When a log message with the configured event code is logged and reaches the central database, the action config is triggered. The tag in the action config has to refer to a MC:SystemAlerter task that can send emails.

Then use the info here to create a new MC:SystemAlerter task. For the new task use the tag from the action config and make it a one-off task. The xml file that needs to be uploaded contains the settings for the emails (see mcSystemAlerter.xsd schema). In here it is possible to use the tag %LOG% in the body of the email. This tag will then be replaced by the logmessage(s) that triggered sending the email. An example:

<mc-system-alerter>
   <alerts>  
      <emailalert>
         <recipients>
            <recipient email="Some.body@somewhere.org"></recipient>
         </recipients>
         <configuration>
            <smtp fromaddress="Some.body@somewhere.org" host="smtp.mailhost.nl"></smtp>
         </configuration>
         <subject>
            <subjectline content="The subject line of the email to send"></subjectline>
            <substitutions></substitutions>
         </subject>
         <body value="%LOG%"></body>
         <attachments></attachments>
      </emailalert>
   </alerts>
</mc-system-alerter>

When scheduling the task, set the start time somewhere in the future, otherwise the task runs immediately. Then search the new task in "scheduled tasks" and set it to suspend. When the action config is triggered, then it copies the suspended task and runs the copy once.

 


NB. Note that the fromaddress field will fallback to InternetAddress.getLocalAddress() which is according to specification but in rare cases will fail to 
provide a suitable fromaddress and will cause errors in the 
synchronisation_log.txt (where the MCSystemAlerter logs its errors). Including the fromaddress will resolve this matter.


 

 

  • No labels