Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 40646 invoked from network); 13 Jun 2006 23:38:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Jun 2006 23:38:11 -0000 Received: (qmail 68413 invoked by uid 500); 13 Jun 2006 23:38:04 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 68343 invoked by uid 500); 13 Jun 2006 23:38:03 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 68332 invoked by uid 99); 13 Jun 2006 23:38:03 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Jun 2006 16:38:03 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [64.81.245.44] (HELO gateway1.uncanny.net) (64.81.245.44) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Jun 2006 16:38:02 -0700 Received: from sandbox.uncanny.net (sandbox.uncanny.net [192.168.49.254]) by gateway1.uncanny.net (Postfix) with ESMTP id EDE752FB for ; Tue, 13 Jun 2006 16:37:40 -0700 (PDT) Received: by sandbox.uncanny.net (Postfix, from userid 1000) id D515F6D0; Tue, 13 Jun 2006 16:37:40 -0700 (PDT) Date: Tue, 13 Jun 2006 16:37:40 -0700 From: Edward Elhauge To: users@cocoon.apache.org Subject: Failure on sending email using Flow. Message-ID: <20060613233740.GA8638@uncanny.net> Reply-To: ee@uncanny.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, I have a problem that is stumping me. I've created a class to send canned email messages; it uses the Sun mail.jar, Debian Linux, Cocoon 2.1.8, and the Jetty AppServer. I can use this class in a stand alone mode and get mail sent out (this is true whether I'm running as myself or as the cocoon user). When I try to use the same class within Flow I get nothing at all. There isn't even an error in the log. The status is always "SENT" so it doesn't seem like an exception is every thrown. Here is how I invoke the class within Flow: var sendMailObj = new SendConfirmMail() ; var sendResult = sendMailObj.sendCanned() ; Here is the stand alone test that works perfectly. ======= CocoonMailTest.java ======= import javax.mail.* ; import javax.mail.internet.* ; import com.roche.rms.bioinfo.SendConfirmMail ; public class CocoonMailTest { public static void main(String args []) { System.out.println("START") ; SendConfirmMail sendMailObj = new SendConfirmMail() ; String result = sendMailObj.sendCanned() ; System.out.println("result " + sendMailStatus) ; System.out.println("END") ; } } ======= END ======= I've included the class I wrote at the bottom. My best guess is that there is something missing in the environment of Cocoon, that my user environment has. Perhaps in the Session Object? Anybody have any ideas on how to debug this? ======= SendConfirmMail.java ======= package com.roche.rms.bioinfo ; import java.util.Properties ; import javax.mail.Session ; import javax.mail.Message ; import javax.mail.MessagingException ; import javax.mail.Transport ; import javax.mail.internet.MimeMessage ; import javax.mail.internet.InternetAddress ; import javax.mail.internet.AddressException ; public class SendConfirmMail { private final static String smtpHost = "127.0.0.1" ; private final static String smtpPort = "25" ; private String _statusMsg = "UNINIT" ; public SendConfirmMail() { _statusMsg = "NEW" ; } public String getStatus() { return _statusMsg ; } public String sendCanned() { String from = "elhaugee" ; String to = "edward.elhauge@roche.com" ; String subject = "Canned Message from Cocoon 1" ; String msgBody = "Body of Canned Message 1" ; return sendMail(from, to, subject, msgBody) ; } public String sendMail(String from, String to, String subject, String msgBody) { // Create a mail session Properties properties = new Properties() ; properties.put("mail.smtp.host", smtpHost) ; properties.put("mail.smtp.port", smtpPort) ; // Session session = Session.getInstance(properties); Session session = Session.getDefaultInstance(properties, null); // Construct the message MimeMessage msg = new MimeMessage(session) ; _statusMsg = "READY" ; try { msg.setFrom(new InternetAddress(from)) ; } catch ( MessagingException e ) { _statusMsg = "FAIL setFrom: " + e ; return _statusMsg ; } try { msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to)) ; } catch ( MessagingException e ) { _statusMsg = "FAIL setRecipient: " + e ; return _statusMsg ; } try { msg.setSubject(subject) ; } catch ( MessagingException e ) { _statusMsg = "FAIL setSubject: " + e ; return _statusMsg ; } try { msg.setContent(msgBody, "text/html; charset=UTF-8") ; } catch ( MessagingException e ) { _statusMsg = "FAIL setContent: " + e ; return _statusMsg ; } // Send the message try { msg.saveChanges() ; } catch ( MessagingException e ) { _statusMsg = "FAIL saveChanges: " + e ; return _statusMsg ; } // Send the message try { Transport trans = session.getTransport("smtp"); trans.send(msg) ; } catch ( MessagingException e ) { _statusMsg = "FAIL Transport.send: " + e ; return _statusMsg ; } _statusMsg = "SENT" ; return _statusMsg ; } } ======= END ======= -- Edward Elhauge "Colourless green ideas sleep furiously." -- Noam Chomsky --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org