[英]how to use Mule SMTP connector with office 365 mailbox to send email ? Also how to use SMTPS in Mule?
Below is the flow code used for sending mails from office 365 mail account :以下是用于从 Office 365 邮件帐户发送邮件的流程代码:
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
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:相同的帐户、凭证、主机、端口在 groovy 脚本中工作:
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.因为看起来groovy脚本有“mail.smtp.starttls.enable”:true,“mail.smtp.ssl.trust”:脚本代码中的主机名作为添加到其中的属性。
So how can i reflect this same using SMTP connector in mule ?那么我如何在 mule 中使用 SMTP 连接器来反映这一点呢?
Any suggestion will be greatful.任何建议都会很棒。
要为 SMTP 连接器启用 starttls,打开电子邮件连接器,单击高级选项卡,单击属性并选择内联,然后添加键:“mail.smtp.starttls.enable”并设置值 = true。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.