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 & Solution</a>.</p> <h2>Simple example</h2> <p>Add this to the transformers in your sitemap</p> <pre><map:transformer name="sendmail" src="org.apache.cocoon.mail.transformation.SendMailTransformer"/> </pre> <p>Add this in a pipeline in your sitemap</p> <pre><map:match pattern="mailme"> <map:generate src="sendmail.xml"/> <map:transform type="sendmail"/> <map:serialize type="xml"/> </map:match> </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><?xml version="1.0" encoding="UTF-8"?> <document xmlns:email="http://apache.org/cocoon/transformation/sendmail"> <email:sendmail> <email:smtphost>my.smtp.host</email:smtphost> <email:smtpport>25</email:smtpport> <email:from>[EMAIL PROTECTED]</email:from> <email:to>[EMAIL PROTECTED]</email:to> <email:subject>My first mail</email:subject> <email:body>The body of the mail</email:body> </email:sendmail> </document> </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 & 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 <!-- -->). 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>
