SMTP错误代码:551

时间:2015-05-26 06:47:07

标签: javax.mail javax.activation

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应用程序运行

,则成功发送

为什么我没有得到这个?提前谢谢。

1 个答案:

答案 0 :(得分: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");`