geralmente utilizo desta forma com o java mail
Properties propertie = new Properties();
propertie.put("mail.transport.protocol", "smtp");
propertie.put("mail.smtp.host", "smtp.live.com");
propertie.put("mail.smtp.socketFactory.port", "587");
propertie.put("mail.smtp.socketFactory.fallback", "false");
propertie.put("mail.smtp.starttls.enable", "true");
propertie.put("mail.smtp.auth", "true");
propertie.put("mail.smtp.port", "587");
session = Session.getDefaultInstance(propertie,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication("[email protected]", "suasenha");
}
});
acredito que é apenas problema no host, tente trocar o
smtp-mail.outlook.com
por
smtp.live.com
.
HtmlEmail email = new HtmlEmail();
email.setHostName("smtp.live.com");
email.setSslSmtpPort(587);
email.setAuthenticator(new DefaultAuthenticator("[email protected]", "suasenha"));
Editado
Exemplo usando o javaMail
public class SendMail {
public static void main(String[]args) throws IOException {
final String username = "[email protected]";
final String password = "suasenha";
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", "outlook.office365.com");
props.put("mail.smtp.port", "587");
Session session = Session.getInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
try {
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("seuemail@outlook"));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse("emaildestino@..."));
message.setSubject("Testando");
message.setText("Olá");
Transport.send(message);
} catch (MessagingException e) {
throw new RuntimeException(e);
}
}
}