cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@cocoon.zones.apache.org
Subject [DAISY] Updated: SendMailTransformer
Date Fri, 18 Aug 2006 12:50:13 GMT
A document has been updated:

http://cocoon.zones.apache.org/daisy/documentation/1099.html

Document ID: 1099
Branch: main
Language: default
Name: SendMailTransformer (unchanged)
Document Type: Sitemap Component (unchanged)
Updated on: 8/18/06 12:50:02 PM
Updated by: Helma van der Linden

A new version has been created, state: publish

Parts
=====

Long description
----------------
This part has been added.
Mime type: text/xml
File name: null
Size: 3216 bytes
Content:
<html>
<body>

<h1>Using SendMailTransfomer with Cocoon 2.1.8 or recent</h1>

<p class="note">The SendMailTransformer needs the
<a href="http://java.sun.com/products/javamail/">JavaMail</a> and
<a href="http://java.sun.com/products/javabeans/glasgow/jaf.html">JavaBeans
Activation Framework (JAF)</a> API's from Sun to work. Add them to WEB-INF/lib.
Remove geronimo-spec-javamail-*.jar and geronimo-spec-activation-*.jar from
WEB-INF/lib. For more information, see <a href="#Problem">Problem &amp;
Solution</a>.</p>

<h2>Simple example</h2>

<p>Add this to the transformers in your sitemap</p>

<pre>&lt;map:transformer name="sendmail" src="org.apache.cocoon.mail.transformation.SendMailTransformer"/&gt;
</pre>

<p>Add this in a pipeline in your sitemap</p>

<pre>&lt;map:match pattern="mailme"&gt;
    &lt;map:generate src="sendmail.xml"/&gt;
    &lt;map:transform type="sendmail"/&gt;
    &lt;map:serialize type="xml"/&gt;
&lt;/map:match&gt;
</pre>

<p>Example of sendmail.xml. The values in this document override those from the
sitemap. You can remove them here if you have set them in the sitemap.</p>

<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;document xmlns:email="http://apache.org/cocoon/transformation/sendmail"&gt;
    &lt;email:sendmail&gt;
        &lt;email:smtphost&gt;my.smtp.host&lt;/email:smtphost&gt;
        &lt;email:smtpport&gt;25&lt;/email:smtpport&gt;
        &lt;email:from&gt;its@me.here&lt;/email:from&gt;
        &lt;email:to&gt;thats@you.there&lt;/email:to&gt;
        &lt;email:subject&gt;My first mail&lt;/email:subject&gt;
        &lt;email:body&gt;The body of the mail&lt;/email:body&gt;
    &lt;/email:sendmail&gt;
&lt;/document&gt;
</pre>

<h2>Advanced examples and parameters</h2>

<p>See
theĀ <a href="http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/mail/transformation/SendMailTransformer.html">
APIdoc</a></p>

<h2 id="Problem">Problem &amp; Solution</h2>

<h3>Problem</h3>

<p>It doesn't matter which SMTP-Host (or SMTP-Port) you fill in, you get the
following error:</p>

<pre>"Could not connect to SMTP host: localhost, port: 25 (java.net.ConnectException:
Connection refused: connect)"
</pre>

<p>if you have a mailserver running on your machine on port 25:</p>

<pre>Exception sending mail java.lang.ClassCastException: java.lang.String
</pre>

<h3>Solution</h3>

<p>Cocoon uses geronimo-spec-javamail-*.jar and geronimo-spec-activation-*.jar
instead of Sun <a href="http://wiki.apache.org/cocoon/JavaMail">JavaMail</a>
and JAF.</p>

<p>Due to licensing issues, it is not possible to ship the Sun jars with Cocoon,
but without these jars, Cocoon would not compile. Therefore the geronimo jars
are included.</p>

<p>Remove geronimo-spec-javamail-*.jar and geronimo-spec-activation-*.jar from
WEB-INF/lib and restart Cocoon.</p>

<p>If this still doesn't work remove geronimo-spec-javamail-*.jar from
/lib/optional and remove it in lib/jars.xml (or comment it with &lt;!-- --&gt;).
Copy src/blocks/mail/mocks from Cocoon 2.1.7 to the same directory in Cocoon
2.1.8 and rebuild Cocoon. Then add Sun
<a href="http://wiki.apache.org/cocoon/JavaMail">JavaMail</a> and Activation
into WEB-INF/lib and remove geronimo-spec-activation-*.jar.</p>

</body>
</html>


Mime
View raw message