SendMailAction

The SendMailAction allows the sitemap to send EMAIL messages on the basis of the data passing through the pipeline. The general format of the action is very similar to the Cocoon version. There are a set of parameters in both the component definition and the pipeline use that define how the SendMailAction works. The component is defined as follows

<map:actions> <map:action name="sendmail" src="resource://lib/acting/SendMailAction"> <smtp-host>xx.xx.xx.xx</smtp-host> <smtp-user>xxxxxxxx</smtp-user> <smtp-password>*********</smtp-password> </map:action> </map:actions>

where

It is best to show an example of SendMailAction to see how it is used in the pipeline. For example a site might use it to send EMAILs using the following in the appropriate sitemap:

<map:match pattern="mail"> <map:act type="sendmail"> <map:parameter name="from" value="enquiries@paloose.org"/> <map:parameter name="to" value="{request-param:to-address}@paloose.org"/> <map:parameter name="subject" value="Paloose Site Mail"/> <map:parameter name="body" value="{request-param:body}"/> <map:aggregate element="root" label="aggr-content"> <map:part src="cocoon:/headings.xml" element="headings" strip-root="true"/> <map:part src="cocoon:/menus.xml" element="menus" strip-root="true"/> <map:part src="cocoon:/newsArticles.xml" element="news-articles" strip-root="true"/> <map:part src="cocoon:/emailOk.xml" element="content" strip-root="true"/> </map:aggregate> <map:call resource="outputPage"/> </map:act> <map:aggregate element="root" label="aggr-content"> <map:part src="cocoon:/headings.xml" element="headings" strip-root="true"/> <map:part src="cocoon:/menus.xml" element="menus" strip-root="true"/> <map:part src="cocoon:/newsArticles.xml" element="news-articles" strip-root="true"/> <map:part src="cocoon:/emailNotOk.xml" element="content" strip-root="true"/> </map:aggregate> <map:call resource="outputPage"/> </map:match>

The generalised structure is

<map:act type="sendmail"> <SendMailAction parameters> <success pipeline> </map:act> <pipeline run if action fails>

where

Copyright 2006 – 2023 Hugh Field-Richards. All Rights Reserved.