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
- smtp-host — (optional) the IP address of
the host to use which will deliver the EMAIL message.
- smtp-user — (optional) the user name of
the mail account.
- smtp-password — (optional) the password
of the mail account.
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
- smtp-host — (optional) the IP address of
the host to use which will deliver the EMAIL message (as above).
- smtp-user — (optional) the user name of
the mail account. (as above)
- smtp-password — (optional) the password
of the mail account. (as above)
- to — (required) the destination of the
message. This can be a list of comma separated email addresses.
- from — (required) the source of the
message. This can be a list of comma separated email addresses.
- cc — (optional) the carbon copy
destination of the message. This can be a list of comma separated email
addresses.
- bcc — (optional) the blind carbon copy
destination of the message. This can be a list of comma separated email
addresses.
- subject — (optional) the subject
text.
- body — (optional) the body
text.
Copyright 2006 – 2023 Hugh Field-Richards. All Rights
Reserved.