Am getting a connection closed by foreign host error on port 465 but working fine for another port 993. What could be the issue.

% telnet x.x.x.x 465 Trying x.x.x.x... Connected to x.x.x.x Escape character is '^]'. Connection closed by foreign host.


Port 465 is the SMTPS port, SMTP over SSL. As such, your probably want to use the openssl tool rather than telnet if you are trying to debug SMTP. This won't solve your original issue though, which is that the remote host is immediately disconnecting you. This may be due to it only allowing connections from certain addresses. The way this is implemented is to accept connections and then close them if they don't originate from an accepted IP address. I would need more details on the SMTP server you are using, and its configuration, to help you more than that.

To use openssl, try:

openssl s_client -connect remote.host:465

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.