Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C24F4B516 for ; Tue, 10 Jan 2012 10:08:44 +0000 (UTC) Received: (qmail 37267 invoked by uid 500); 10 Jan 2012 09:50:30 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 35906 invoked by uid 500); 10 Jan 2012 09:50:06 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 35851 invoked by uid 99); 10 Jan 2012 09:49:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jan 2012 09:49:52 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [173.12.115.225] (HELO mail.strikeind.com) (173.12.115.225) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jan 2012 09:49:44 +0000 Received: from Strikeserver.Strikeind.com ([::1]) by Strikeserver.Strikeind.com ([::1]) with mapi; Tue, 10 Jan 2012 04:50:19 -0500 From: Frank Sullivan To: "user@commons.apache.org" Date: Tue, 10 Jan 2012 04:49:23 -0500 Subject: [email] JavaMail works Commons Email does not Thread-Topic: [email] JavaMail works Commons Email does not Thread-Index: AczPeccB2ECircb8RPiTSCgdVTSjXg== Message-ID: <68D75A0B00E793449B5E2E4E760890909F676D6516@Strikeserver.Strikeind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: multipart/alternative; boundary="_000_68D75A0B00E793449B5E2E4E760890909F676D6516StrikeserverS_" MIME-Version: 1.0 --_000_68D75A0B00E793449B5E2E4E760890909F676D6516StrikeserverS_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I have a web application (Flex, Spring, Hibernate) that has a simple email = module that uses Common Email. Currently it only sends plain text messages= . Here is basically what happens: HtmlEmail email =3D new HtmlEmail(); email.setHostName(smtpHost); email.setAuthentication(smtpUser, smtpPassword); email.setTextMsg(plainText); email.setSubject(subject); email.addTo(recipientAddress); email.setFrom(fromAddress); email.send(); The problem is that is only works when invoke it from simple Java applicati= on. It does not work from a within the Spring service that is running in t= he Tomcat container. Even weirder is that if I put straight JavaMail code = in the Spring service, it works! Properties props =3D new Properties(); props.put("mail.smtp.host", smtpHost); props.put("mail.smtp.user", smtpUser); props.put("mail.smtp.password", smtpPassword); Session session =3D Session.getDefaultInstance(props); Message msg =3D new MimeMessage(session); msg.setFrom(new InternetAddress(fromAddress)); msg.setRecipients(Message.RecipientType.TO, new InternetAddress[]{new Inter= netAddress(recipientAddress)}); msg.setSubject(subject); msg.setText(plainText); Transport.send(msg); Any clues? Thanks, Frank Sullivan --_000_68D75A0B00E793449B5E2E4E760890909F676D6516StrikeserverS_--