Here are some Cocoon-Components for Cocoon 2.0 including a MailTransformer. These components are only tested with Cocoon 2.0.4 .
<!-- in the map:components section --> <map:transformers> <map:transform name="mymail" src="de.miethxml.cocoon.transform.SendMailTransformer"> <parameter name="mailhost" value="localhost" /> <parameter name="from" value="nobody@localhost" /> </map:transformer> </map:transformers> <!-- a simple pipeline --> <map:pipeline> <map:match pattern="test/mail"> <map:generate src="mailtest.xml"/> <map:transform type="mymail"/> <map:serialize type="xml"/> </map:match> </map:pipeline>
You must set the MIME-Type for the attachment by hand, it will not be detected automatically.
<?xml version="1.0" ?> <doc xmlns:mail="http://miethxml/sendmail"> <mail:sendmail> <mail:mailto>foo@localhost</mail:mailto> <mail:mailfrom>nobody@localhost </mail:mailfrom> <mail:mailsubject>Cocoon Mailtransformer</mail:mailsubject> <mail:mailbody>Here comes a mail from Cocoon with nice attachments.</mail:mailbody> <mail:attachment mimetype="application/pdf">cocoon://hello.pdf</mail:attachment> <mail:attachment mimetype="image/jpeg">cocoon://hello.svg</mail:attachment> </mail:sendmail> </doc>