Subscribe to our Newsletter. The latest news and articles delivered to your Inbox!
A Software Development Consultant with over 20 years of experience. Many of his projects involved Exchange integrated applications, including a FAX server, a mail security product and anti-spam products.
Telnet allows submitting emails to any SMTP server manually. Stepping through the SMTP protocol is an excellent opportunity to test and troubleshoot an email server. Here is what any email administrator should know.
The Simple Mail Transfer Protocol SMTP defines a command/reply sequence allowing the transport and delivery of emails. This de facto standard is defined by RFC2821 and is probably one of the most fundamental to email administrators. A good understanding of SMTP can be very useful especially when testing and troubleshooting email delivery.
We shall see how to connect directly to the Exchange SMTP server and submit an email. In a second article we will put this knowledge into practice and test/troubleshoot various Exchange features.
SMTP is a text based protocol. Commands and responses are transmitted in US-ASCII text. Establishing an SMTP connection is a simple matter of running:
telnet <host> 25
Telnet attempts to establish a connection to port 25 on the server identified by <host>. Port 25 is the standard port to which SMTP servers listen for inbound connections. The port number is configurable from the Exchange SMTP virtual server properties. However this is only done in very particular configuration scenarios.
The host may be identified by name or IP. When connecting to an SMTP server running on the same machine, localhost could also be used. Using a host name may sound simpler. However this involves an extra name resolution step in order to obtain the IP. Thus specifying the IP at the command line is the most direct way to connect.
Once connected, Exchange greets us with a successful response. SMTP responses start with a 3 digit code. The leading digit is the most interesting to us as summarized below.
2xx and 3xx - operation successful
4xx - temporary error, the server failed to handle the command at this time
5xx - permanent error
When troubleshooting, error responses are the most interesting. 4xx codes indicate that we may want to retry submitting the email at a later time. The receiving server might recover from its failure state and handle it. On the other hand there is no hope for emails rejected with a 5xx code.
Once connected, we may proceed to submit our first command. Exchange supports the Extended SMTP (ESMTP) specifications; hence this will be the EHLO command:
EHLO takes the fully qualified sending domain as parameter. Exchange returns a sequence of success responses listing supported extensions. These are beyond our scope.
We next submit the MAIL command:
This identifies the sender address. Exchange responds, letting us know the sender is ok.
It is now time to identify the email recipients. This involves submitting an RCPT command for each recipient address.
In this case I am submitting the email to two recipients. Thus I submit two RCPT commands, to which Exchange responds successfully.
Add New Comment...