commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: [EMAIL] Using Apache Commons Email and Google
Date Mon, 16 Nov 2009 21:26:42 GMT
Hash: SHA1


On 11/16/2009 1:27 PM, Stefano "Kismet" Lenzi wrote:
> On Mon, Nov 16, 2009 at 16:45, Christopher Schultz
> <> wrote:
>> Try setting -Dmail.debug=true and run it again. This will give you much
>> more output from Javamail.
> I have tried to set the option but the output didn't change

Hmm... that's strange. I thought javamail would read system properties
as well as those set directly using a java.util.Properties object, but
maybe it doesn't. Commons-email doesn't appear to give you the option of
setting javamail properties directly, but it does allow you to set the
javamail session like this:

Properties props = new Properties();
props.put("mail.transport.protocol", "smtps");

Session session = Session.getDefaultInstance(props);


This should allow you to set properties such as mail.debug,
mail.transport.protocol, etc.

>>> DEBUG SMTP: trying to connect to host "", port 465, isSSL false
>> See that SSL=false. If you want SSL, use setSSL(true) instead of
>> setTLS(true).
> I don't know why I haven't tried it before, but I'm glad to say that
> it worked :)

Glad to help.

> In particular, the lines:
> "DEBUG: getProvider() returning
> javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
> Microsystems, Inc]"

I don't find anything strange about the above log message, do you?

> "DEBUG SMTP: trying to connect to host "", port 465, isSSL false"

Now /that/ is strange if you have set SSL=true. Perhaps there's a bug in
the debug logging.

I have found that commons-email acts strangely in a number of
circumstances. I unfortunately had to abandon its use a while back in
order to be able to send attachments along with text *and* HTML email
messages. I wrote my own wrapper with what I believe is a simpler API.
You are welcome to it:

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


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

View raw message