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.