This program attempts to send e-mail but throws a run time exception:
javax.mail.AuthenticationFailedException: failed to connect, no password specified?
I have just faced this problem, and the solution is that the property "mail.smtp.user" should be your email (not username).
The example for gmail user:
properties.put("mail.smtp.starttls.enable", "true");
properties.put("mail.smtp.host", host);
properties.put("mail.smtp.user", from);
properties.put("mail.smtp.password", pass);
properties.put("mail.smtp.port", "587");
properties.put("mail.smtp.auth", "true");