mieth-xml.de
Cocoon-Components

Introduction

Here are some Cocoon-Components for Cocoon 2.0 including a MailTransformer. These components are only tested with Cocoon 2.0.4 .

Installation

  • 1. Download the JavaMail (here) and copy the "mail.jar" in the cocoon/WEB-INF/lib.
  • 2. Download the JAVABEANS ACTIVATION FRAMEWORK (JAF) (here) and copy the "activation.jar" to cocoon/WEB-INF/lib.
  • 3. Copy the "miethxml.jar" (download here) in the cocoon/WEB-INF/lib-Directory and setup the componentes in the Sitemap.xmap or SubSitemap.xmap.
  • 4. Restart Cocoon.

Sitemap-Example

<!-- 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>

Sitemap-Example

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>

Download