0

com.sun.mail.smtp.SMTPSendFailedException: 551 This mail server requires authentication before sending mail from a locally hosted domain. Please reconfigure your mail client to authenticate before sending mail.

当我与在 Tomcat 服务器上运行的 Java 应用程序集成时出现上述错误

如果我在带有 main 的单独类中使用相同的属性并作为 java 应用程序运行,则发送成功

为什么我没有得到这个?先感谢您。

4

1 回答 1

0
Finally got answer
Here we go: before it was like
`Properties props = new Properties();
props.put("mail.smtp.host", "webmail.technobbyte.com");
props.put("mail.smtp.port", "25");
props.put("mail.smtp.starttls.enable", true);
props.put("mail.smtp.auth", true);`


now i changed to:
`Properties props = new Properties();
props.setProperty("mail.smtp.host", "webmail.technobbyte.com");
props.setProperty("mail.smtp.port", "25");
props.setProperty("mail.smtp.starttls.enable", "true");
props.setProperty("mail.smtp.auth", "true");`
于 2015-05-26T10:02:54.657 回答