This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Sounds like you may not be properly registering the SMTP server that JavaMail is to use. Without that, how would it know where to send the mail through? The following code snippets should give you enough clues:
This the code snippet which i am using in my jsp page. I moved the same code on the different testing server of my company, where it worked. But i wanted to know why it gave me "javax.mail.MessagingException: 501 HELO requires domain address" exception in the first server. I am using tomcat web server. My SMTP Server is accessible, as i can telnet and connect to that server. So i wanted to know the reason for this exception and how it can be avoided.