Below is the flow code used for sending mails from office 365 mail account :
Exception received is : com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM
Same account , credentials, Host , port works in groovy script:
public static void simpleMail(String from, String password, String to,
String subject, String body) throws Exception {
String host = "smtp.office365.com";
Properties props = System.getProperties();
props.put("mail.smtp.starttls.enable",true);
props.setProperty("mail.smtp.ssl.trust", host);
props.put("mail.smtp.auth", true);
props.put("mail.smtp.host", host);
props.put("mail.smtp.user", from);
props.put("mail.smtp.password", password);
props.put("mail.smtp.port", "587");
Session session = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
InternetAddress toAddress = new InternetAddress(to);
message.addRecipient(Message.RecipientType.TO, toAddress);
message.setSubject(subject);
message.setText(body);
Transport transport = session.getTransport("smtp");
transport.connect(host, from, password);
transport.sendMessage(message, message.getAllRecipients());
transport.close();
System.out.println("Mail Sent Successfully");
}
as it seems groovy script has "mail.smtp.starttls.enable" : true, "mail.smtp.ssl.trust" : hostname in the script code as property added in it.
So how can i reflect this same using SMTP connector in mule ?
Any suggestion will be greatful.
要为 SMTP 连接器启用 starttls,打开电子邮件连接器,单击高级选项卡,单击属性并选择内联,然后添加键:“mail.smtp.starttls.enable”并设置值 = true。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.