You should change the port to 587
, I tested your code and it's working fine
If error still happens, please change session variable to code below:
Session session = Session.getInstance(props, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(userName, password);
}
});