Reputation: 15
I'm using Outlook, with another provider works fine.
My Properties:
Properties props = new Properties();
props.setProperty("mail.transport.protocol", protocol.toLowerCase());
props.setProperty("mail.smtp.starttls.enable", "true");
props.setProperty("mail.smtp.auth", "true");
props.setProperty("mail.host", host);
props.setProperty("mail.port", String.valueOf(port));
props.setProperty("mail.smtp.timeout", String.valueOf(smtpTimeout * 1000));
props.setProperty("mail.smtps.timeout", String.valueOf(smtpTimeout * 1000));
if (protocol.toLowerCase().equals("smtps")) {
props.setProperty("mail.smtps.host", host);
props.setProperty("mail.smtps.port", String.valueOf(port));
if (username != null) {
props.setProperty("mail.smtps.user", username);
}
if (password != null) {
props.setProperty("mail.smtps.auth", "true");
}
} else {
props.setProperty("mail.smtp.host", host);
props.setProperty("mail.smtp.port", String.valueOf(port));
if (username != null) {
props.setProperty("mail.smtp.user", username);
}
if (password != null) {
//props.setProperty("mail.smtp.auth", "true");
}
}
The error produced:
javax.mail.AuthenticationFailedException:
535 5.7.3 Authentication unsuccessful [ZRAP278CA0016.CHEP278.PROD.OUTLOOK.COM]
If I don't add mail.smtp.starttls.enable
, authentication works but can't send SMTP message.
Upvotes: 0
Views: 4185
Reputation: 15
RESOLVED: Two things:
(With IMAP works without add domain)
Sorry for my bad english, thaks to all
Upvotes: 0