This program attempts to send e-mail but throws a run time exception:
javax.mail.AuthenticationFailedException: failed to connect, no password specified?
Your email session should be provided an authenticator instance as below
Session session = Session.getDefaultInstance(props,
new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
"myemail@gmail.com", "password");
}
});
a complete example is here http://bharatonjava.wordpress.com/2012/08/27/sending-email-using-java-mail-api/