我在发送 java 邮件时在 centOS 服务器上遇到问题。出现以下异常。
<小时/>javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25, response: -1
我在命令提示符下使用了以下命令,并按预期收到了邮件。
echo "testing" | mail -s"test subject" shantanu.oa@gmail.com
<小时/>
邮件日志中的相关条目如下所示...
Mar 28 20:13:16 postfix/smtpd[10120]: fatal: no SASL authentication mechanisms
Mar 28 20:13:17 postfix/master[28163]: warning: process /usr/libexec/postfix/smtpd pid 10120 exit status 1
Mar 28 20:13:17 postfix/master[28163]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling
Mar 28 20:26:22 postfix/smtpd[11001]: warning: SASL: Connect to private/auth failed: Connection refused
如何解决这个问题?
最佳答案
来自日志条目
Mar 28 20:13:16 postfix/smtpd[10120]: fatal: no SASL authentication mechanisms
我怀疑问题出在 Postfix 上,我不是这方面的专家。谷歌搜索“致命:没有 SASL 身份验证机制”给出了很多有趣的链接:也许看看 here或here .
关于java - 通过Java发送邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5469362/