Hi All,
I am trying to send E-Mail using vert.x mail client using microsoft exchange. My code is attached below.
public static void main(String[] args) {
Vertx vertx = Vertx.vertx();
MailConfig mailConfig = new MailConfig();
mailConfig.setHostname("smtp.office365.com");
mailConfig.setPort(587);
mailConfig.setLogActivity(true);
mailConfig.setStarttls(StartTLSOptions.REQUIRED);
mailConfig.setLogin(LoginOption.REQUIRED);
mailConfig.setUsername("ma...@company.com");
mailConfig.setPassword("Password");
mailConfig.setSsl(false);
MailClient mailClient = MailClient.create(vertx, mailConfig);
MailMessage message = new MailMessage();
message.setFrom(mailConfig.getUsername());
message.setTo("some...@somecompany.com");
message.setText("This is a Test Mail");
mailClient.sendMail(message,res->{
if(res.succeeded()) {
System.out.println("Mail Sent");
} else {
res.cause().printStackTrace();
}
});
}
when I running this code I am getting this exception
WARNING: AUTH LOGIN failed 535 5.7.3 Authentication unsuccessful
io.vertx.core.impl.NoStackTraceThrowable: Failed to authenticate
and when I add the Auth method I it is saying not valid auth method.
Please help with what I should add as Auth method and also let me know if I am doing something wrong.
Regards
Prajeesh K P