Saturday, February 22, 2014

Java Mail API traces

As usual "it depends". According to http://www.oracle.com/technetwork/java/faq-135477.html#debug:

Q: How do I debug my application that uses JavaMail APIs?
A: Turn on session debugging by invoking the method setDebug(true) on the Session object in your code. That will cause debug information to be printed to the console, including a protocol trace. If you passed the System properties to the Session when you created it, you can simply run your program with java -Dmail.debug=true ...
If you think that you found a bug in JavaMail, send us this trace along with a test case that reproduces the problem, the platform you are using, the version of the JDK you are using, and the name and version of the mail servers (IMAP, SMTP) that you are using.

That means it depends on your application details. For example if you are using Spring Framework you probably need something like the below and nothing else: