从 Apache Camel 向 Office.365 发送电子邮件时出现 SMTP 错误 530 5.7.57

SMTP Error 530 5.7.57 when sending email from Apache Camel to Office.365

错误信息:com.sun.mail.smtp.SMTPSendFailedException:530 5.7.57 SMTP;在 MAIL FROM

期间客户端未通过身份验证以发送匿名邮件

Apache ActiveMQ 5.15.0 - 阿帕奇骆驼 2.19.1 - JavaMail 版本 1.4.7 -

--mailer.properties

camel.smtpserver=smtp.office365.com:587

camel.smtpUser=xxx@xxx.com

camel.smtpPassword=xxx

camel.smtpfrom=xxx@xxx.com

camel.smtpto=xxx@xxx.com

xxx@xxx.com: 一个有效的 office365 帐户

--Camel.xml

<to uri="smtp://{{camel.smtpserver}}?password={{camel.smtpPassword}}&amp;username={{camel.smtpUser}}&amp;mail.smtp.auth=true&amp;mail.smtp.starttls.enable=true&amp;from={{camel.smtpfrom}}&amp;to={{camel.smtpto}}&amp;contentType=text/html"/>

-- 感谢您的帮助!

您可以尝试像下面这样修改您的url

smtp://{{camel.smtpUser}}:{{camel.smtpPassword}}@{{camel.smtpserver}}?mail.smtp.auth=true&amp;mail.smtp.starttls.enable=true&amp;from={{camel.smtpfrom}}&amp;to={{camel.smtpto}}&amp;contentType=text/html

用户名中存在 @ 字符也很重要。