使用 JavaMail 与 MS Exchange 服务器的连接挂起
(如果这是一个重复的问题,请给我发送一个指向相应线程的链接。)
我使用 JavaMail API 编写了一个 Java 程序,通过 Gmail 向多个用户发送电子邮件,并且运行良好。然而,当我尝试使用相同的代码(稍加修改)来使用 MS Exchange Server 发送电子邮件时,程序挂起。
它没有抛出任何异常,所以我假设它能够建立连接。 (我曾尝试使用其他端口或错误的 SMTP 地址,它给了我一个“连接被拒绝”异常。)
这是最后一条语句,程序在此之后不会终止:
[DEBUG SMTP: attempts to connect to host "[xxx. yyy.com]”,端口 135,isSSL false]
请理解,我不需要代码方面的帮助,但我只是想了解发生了什么。
我很感激你的时间。
(If this is a duplicate question, please send me a link to the appropriate thread.)
I wrote a Java program using JavaMail API to send an email to several users through Gmail and it worked perfectly. However, when I tried to use the same code (with slight modification) to use MS Exchange Server to send emails, the program hangs.
It did not throw any exceptions, so I am assuming that it is able to make the connection. (I had tried using other ports or wrong SMTP address and it gave me a 'Connection refused' exception.)
This was the last statement and the program does not terminate after that:
[DEBUG SMTP: trying to connect to host "[xxx.yyy.com]", port 135, isSSL false]
Please understand that I do not need help with the code, but I just want to understand what's going on.
I appreciate your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要连接到 SMTP 的端口 25,而不是端口 135。(SMTP 是端口 465。)
You need to connect to port 25 for SMTP, not port 135. (SMTPs is port 465.)