Title: Re: alternative to sendmail logicsheet?

Rick,
I had to include mail functionality just last week and I approached the
task with some trepidation as it seems that both the sendmail action and
logicsheet are starting to lose favour with the advent of Cforms and flow.
What to do?
I did some scouring and stumbled across the sendmail transformer. Its
been included for quite some time but probably hasn't achieved the
prominence of the other two methods.
Check it out.
In the sitemap I added this:
            <map:match pattern="edmUploadFile">            
                <map:generate type="session-attr">
                    <map:parameter name="attr-name"
value="uploadDocMetaData"/>
                </map:generate>  
                <map:transform src="">
                <map:transform type="sendmail"/>                 
                <map:serialize type="xml" />              
            </map:match>
           
I'm passing an xml document created in flow in a session attribute but
it could come from XSP. I then transform it using a stylesheet, the guts
of which is:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:email="http://apache.org/cocoon/transformation/sendmail">


<xsl:template match="document">
    <document>
        <email:sendmail>
            <email:smtphost><xsl:value-of
select="smtpHostName"/></email:smtphost>      
            <email:from><xsl:value-of
select="emailFrom"/></email:from>          
            <email:to><xsl:value-of select="edmInbox"/></email:to>      
            <email:to><xsl:value-of select="emailFrom"/></email:to>      
            <email:subject><xsl:value-of
select="title"/></email:subject>      
            <email:body><xsl:value-of select="assetId"/></email:body>
            <email:attachment>
                <xsl:attribute name="name"><xsl:value-of
select="fileName"/></xsl:attribute>
                <xsl:attribute name="url"><xsl:value-of
select="uploadURL"/></xsl:attribute>
            </email:attachment>
            <email:attachment>
                <xsl:attribute name="name">metaFile.xml</xsl:attribute>
                <xsl:attribute name="mime-type">text/xml</xsl:attribute>
                <email:content><document><xsl:copy-of
select="*"/></document></email:content>
            </email:attachment>          
        </email:sendmail>
    </document>
</xsl:template>

<xsl:template match="@*|node()"
priority="-2"><xsl:copy><xsl:apply-templates
select="@*|node()"/></xsl:copy></xsl:template>
<xsl:template match="text()" priority="-1"><xsl:value-of
select="."/></xsl:template>

</xsl:stylesheet>
Make sure you've declared the sendmail transformer in your sitemap and
you're all set:
<map:transformer name="sendmail"
src=""
logger="sitemap.transformer.sendmail"/>      

Its a snack.

Hope this helps,
Regards
Tony

Rick Tyler wrote:

> Since no-one answered my question about how to fix the BROKEN sendmail
> logicsheet example distributed with Cocoon-2.1.6, can anyone please
> tell me of an alternative method of sending email from XSP?  I know
> about the sendmail action method which doesn't work either in the Send
> EMail sample application), but that wouldn't be sufficient in any case
> because I need to do other processing besides just sending an email.
>
> Please help somebody.
>
> RT
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

---------------------------------------------------------------------
This email is from Civica Pty Limited and it, together with any attachments, is confidential to the intended recipient(s) and the contents may be legally privileged or contain proprietary and private information. It is intended solely for the person to whom it is addressed. If you are not an intended recipient, you may not review, copy or distribute this email. If received in error, please notify the sender and delete the message from your system immediately.

Any views or opinions expressed in this email and any files transmitted with it are those of the author only and may not necessarily reflect the views of Civica and do not create any legally binding rights or obligations whatsoever. Unless otherwise pre-agreed by exchange of hard copy documents signed by duly authorised representatives, contracts may not be concluded on behalf of Civica by email.

Please note that neither Civica nor the sender accepts any responsibility for any viruses and it is your responsibility to scan the email and the attachments (if any). All email received and sent by Civica may be monitored to protect the business interests of Civica.

---------------------------------------------------------------------

Reply via email to