commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Sullivan <>
Subject RE: [email] JavaMail works Commons Email does not
Date Tue, 10 Jan 2012 10:54:17 GMT
Nothing happens.  No exceptions.  No logging (I set logging for "org.apache.commons.mail" to
TRACE).  Nothing.

Thanks, Frank

-----Original Message-----
From: Konstantin Kolinko [] 
Sent: Tuesday, January 10, 2012 5:37 AM
To: Commons Users List
Subject: Re: [email] JavaMail works Commons Email does not

2012/1/10 Frank Sullivan <>:
> 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 = 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 application.  It does
not work from a within the Spring service that is running in the Tomcat container.  Even
weirder is that if I put straight JavaMail code in the Spring service, it works!
> Properties props = new Properties();
> props.put("", smtpHost); props.put("mail.smtp.user", 
> smtpUser); props.put("mail.smtp.password", smtpPassword); Session 
> session = Session.getDefaultInstance(props);
> Message msg = new MimeMessage(session); msg.setFrom(new 
> InternetAddress(fromAddress)); 
> msg.setRecipients(Message.RecipientType.TO, new InternetAddress[]{new 
> InternetAddress(recipientAddress)});
> msg.setSubject(subject);
> msg.setText(plainText);
> Transport.send(msg);
> Any clues?

How exactly it fails?
What exception is there if any?

Best regards,
Konstantin Kolinko

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message