cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Edwards <tedwa...@civica.com.au>
Subject Re: using sendmail action
Date Mon, 27 Jun 2005 22:41:27 GMT
Sergio,
Here's the content of the email:
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="xsl/xml2email.xsl"/>
                <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="org.apache.cocoon.mail.transformation.SendMailTransformer"
logger="sitemap.transformer.sendmail"/>      

Its a snack.

Hope this helps,
Regards
Tony



sergio_santoro@libero.it wrote:

>thank you...but, how
>can i read that
>message?
>I'm new to this
>list.
>
>
>
>
>
>
>
>----------------------
>
>>Hi Sergio,
>>I went for the
>>
>send mail
>transformer as it
>was only thing I
>managed to 
>
>>get going. I gave
>>
>up on the action.
>
>>I wrote a response
>>
>to a similar query
>on the 10 of
>February this year
>if 
>
>>you want to get
>>
>some background and
>code on using the
>transformer.
>
>>Regards,
>>Tony
>>
>>
>>
>sergio_santoro@libero.it
>wrote:
>
>>>Hi, I'm trying to
>>>use the sendmail
>>>action in
>>>cocoon...I'm
>>>
>having
>
>>>troubles.
>>>I've read the
>>>documentation for
>>>this action but
>>>
>I've
>
>>>found it not
>>>well-explanating.
>>>Can anyone tell
>>>
>me
>
>>>where to find
>>>complete help for
>>>
>
>>>setting up Cocoon
>>>for working with
>>>e-mails sending?
>>>thank you very
>>>
>much
>
>>>Sergio
>>>
>>>
>>>
>>>
>>____________________________________________________________
>>
>>>6X velocizzare la
>>>
>tua navigazione a
>56k? 6X Web
>Accelerator di
>Libero!
>
>>>Scaricalo su
>>>
>INTERNET GRATIS 6X
>http://www.libero.it
>
>>>
>>>
>>---------------------------------------------------------------------
>>
>>>To unsubscribe,
>>>
>e-mail:
>users-unsubscribe@cocoon.apache.org
>
>>>For additional
>>>
>commands, e-mail:
>users-help@cocoon.apache.org
>
>>>
>>> 
>>>
>>>
>>
>---------------------------------------------------------------------
>
>>To unsubscribe,
>>
>e-mail:
>users-unsubscribe@cocoon.apache.org
>
>>For additional
>>
>
>commands, e-mail:
>users-help@cocoon.apache.org
>
>>
>
>
>
>____________________________________________________________
>6X velocizzare la tua navigazione a 56k? 6X Web Accelerator di Libero!
>Scaricalo su INTERNET GRATIS 6X http://www.libero.it
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message