bible:~ # telnet localhost smtp
Connected to localhost.
Escape character is ,A]'.
220 bible.suse.com ESMTP Postfix ehlo localhost
mail from: [email protected]
250 Ok rcpt to: [email protected]
250 Ok data
354 End data with <CR><LF>.<CR><LF>
This is a test mail that I am sending you.
250 Ok: queued as 6D5CF18490
We have used the SMTP protocol to specify that we are sending an e-mail to the user [email protected] from the user [email protected] from the machine localhost (ehlo localhost). This is a standard SMTP protocol transaction that can be used to quickly test an SMTP server's ability to send mail to a specific user.
We discuss mail servers and provide a further example of using Telnet to test a service in Chapter 17.
The command line used, telnet localhost smtp, is the same command line used previously with the addition of the port specification (smtp). The port you connect to can either be in text form (as we used) or in numerical form. The port number for the SMTP protocol is port 25.
From now on in the book, we will refer to TCP/IP ports more and more. A TCP/IP port can be thought of as a virtual plug that serves a specific purpose. Each port has a unique number and a number of well-known port numbers have been reserved for specific purposes. For example, port 80 is HTTP, port 25 is SMTP, and port 21 is FTP. View the file /etc/services for more information on the well-known port numbers.
If security is a concern for your organization, then Telnet should not be used to transmit sensitive information. As all information is plain text, it just is not safe.
Was this article helpful?