MacOS – Simple telnet session fails on OS X

macossmtpterminal

I am learning Postfix and how it works with SMTP, and here's a sample session that the book shows as an example:

enter image description here

I ran the command hostname on my Mac terminal, and it showed <some_id>.ant.amazon.com (it is my office laptop). So I tried

telnet  <id>.ant.amazon.com 25

And I got the error message:

<id>.ant.amazon.com: nodename nor servname provided, or not known

Then I tried telnet 10.232.45.151 25 as well. It showed the message Trying 10.232.45.151… for a long time before quitting with the message:

telnet: connect to address 10.232.45.151: Operation timed out
telnet: Unable to connect to remote host

I tried telnet localhost 25 as well, with this output:

Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host

What am I doing wrong? How do I have a session like the one shown in the picture?

Best Answer

If you do not have a mail server running then there is nothing listening on port 25. Thus connection refused messages. So you need to run the mail server first.

Also unless you work for Amazon your hostname is not .ant.amazon.com If you do ask your network admins.

And this bit is a comment - I think you need to learn what telnet does before you start trying to run services.