I am running a lightweight SMTP server for processing incoming emails. I am using https://github.com/kennethreitz/inbox.py. I opened port 25 in my firewall and am running the server at 0.0.0.0:25.
Everything is functioning as I expect. When I send email to firstname.lastname@example.org the server receives the message.
The thing that is strange to me is that when I telnet to port 25 from outside the VPS, it does not connect and times out:
$ telnet mydomain.com 25 Trying <IP address removed>... telnet: connect to address <IP address removed>: Operation timed out telnet: Unable to connect to remote host
When I telnet from inside the VPS, it works as it should:
$ telnet localhost 25 Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 hobnob Python SMTP proxy version 0.2
I cannot think of any reason why this happening. What could it be?
I was able to establish a connection using a Python shell:
from smtplib import SMTP conn = SMTP('mydomain.com')
I confirmed that this will fail if the server is not running. It seems maybe that telnet cannot make the connection correctly? I'm not sure, but it is clear that connections can be made to the server by email software which is what I was really trying to test.