Using SendMailTransfomer with Cocoon 2.1.8

The SendmailTransformer needs the JavaMail and JavaBeans Activation Framework (JAF) API's from Sun to work. Add them to build/webapp/WEB-INF/lib.

Example

<?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:from>its@me.here</email:from>
        <email:to>thats@you.there</email:to>
        <email:subject>My first mail</email:subject>
        <email:body>The body of the mail</email:body>
    </email:sendmail>
</document>

Problem

It doesn't matter which SMTP-Host (or SMTP-Port) you fill in, you get the following error (unless you have a mailserver running on your machine on port 25):

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

Solution

Cocoon uses geronimo-spec-javamail-1.3.1-rc5.jar and geronimo-spec-activation-1.0.2-rc4.jar (or the version that is included with your distribution) instead of Sun JavaMail and JAF. Remove the Geronimo JavaMail and Geronimo Activation from build/webapp/WEB-INF/lib and restart Cocoon.

JashaJoachimsthal (last edited 2009-09-20 23:41:35 by localhost)