(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 connect开发者_如何学Cion. (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.
You need to connect to port 25 for SMTP, not port 135. (SMTPs is port 465.)
精彩评论