Debug a Javamail Program

From CodeCodex

Implementations[edit]

Java[edit]

Set the Javamail DEBUG mode "on" :

Session mailSession = Session.getDefaultInstance(props, null);
mailSession.setDebug(true);

This setting puts the Javamail classes in verbose mode to System.out. Verify connectivity to the MailServer with Telnet :

telnet mymailserver 25

for example, you can detect if your firewall is blocking your connection. Use a Javamail server mock-up to act as "in-memory" mail server : See https://mock-javamail.dev.java.net/ and http://quintanasoft.com/dumbster/. These mock-ups are designed to act a mail server but the actual email is not delivered to the mail recipient which can be useful in a testing stage.