Cry Exchange How To...
Use telnet to test email (SMTP) delivery
You can use telnet (the command line utility) to test whether your email (SMTP) server is receiving emails. You can also use it to test that your server is not an open-relay.
To send an email using telnet
- Open the command prompt
(Typically Start > run > cmd) - type:
telnet mail.server 25
where "
mail.server
" is the name of your mail server. This can either be the name of the server if it is on a LAN or its fully qualified DNS name. For examplecryer.co.uk
. The number 25 is the port number that telnet is to connect on, this is always 25 for e-mail SMTP communications.The server will acknowledge with a line that will identify the server.
- type:
HELO computer.name
Where "
computer.name
" is simply a name to identify your computer. It can be anything you want or it can be blank. - type:
MAIL FROM: sender.email
where "
sender.email
" is your email address. This is the address that the email will appear to be from. You should get a response starting with "250" and ending with "OK". - Type:
RCPT TO: recipient.email
where "
recipient.email
" is the email address you are sending to. You should get a response starting with "250" and ending with "OK". - Type:
DATA
then type your message.
- To indicate the end of your message enter a full stop (".") on its own on a line followed by pressing Enter.
- To close the telnet session enter:
QUIT
Some gotchas when using telnet:
- Be aware that a backspace may appear to delete the character to the left of the cursor, but in fact all it does is add a backspace character to what you are sending. So when you type be sure to be accurate and don't use backspace.
Other uses
Being able to send emails using telnet provides you with a simple way to:
- test that your exchange server cannot be used as an open relay. Check that you cannot send an email (that is not destined for your server) via your server from a location outside of your network.
- test a backup-email server without taking your primary email server off-line - by connecting to it explicitly.
These notes have been tested with Exchange Server 2010 and Exchange Server 2003.
About the author: Brian Cryer is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.