Hi Frank,
that's a feature - in order to minimize the dependencies there is no
logging framework used. But I'm surprised that no hint was found in the
stack trace ....
Siegfried Goeschl
On 12.01.12 01:30, Frank Sullivan wrote:
Thanks everyone for you responses. Chalk this one up to user
misunderstanding/error.
Siegfried suggestion was spot on. Setting debug the true, showed the error: a bad email
address in the test data that the web app used. I am surprised though that Commons Email
doesn’t make better use of logging. In trying to figure this out I wrote my own wrapper
for JavaMail. In my wrapper, I have "session.setDebug(log.isDebEnabled())".
Thanks, Frank
-----Original Message-----
From: Siegfried Goeschl [mailto:[email protected]]
Sent: Tuesday, January 10, 2012 11:38 AM
To: Commons Users List
Subject: Re: [email] JavaMail works Commons Email does not
Hi folks,
it is also useful to call Mail.setDebug(true) which turns on the debugging of
the mail session. Having said that some stepping though the code might provide
some insight ... :-)
Cheers,
Siegfried Goeschl
On 10.01.12 12:06, Christian Grobmeier wrote:
On Tue, Jan 10, 2012 at 11:54 AM, Frank Sullivan
<[email protected]> wrote:
Nothing happens. No exceptions. No logging (I set logging for
"org.apache.commons.mail" to TRACE). Nothing.
Thats weird. Have you tried to debug and look if all properties are
set or if the code is actually called?
Cheers
Thanks, Frank
-----Original Message-----
From: Konstantin Kolinko [mailto:[email protected]]
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<[email protected]>:
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("mail.smtp.host",
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: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]