Using telnet to diagnose issues with sending mail.

Telnet is a great tool and was once used for logging into Unix machines. Its not used for that purpose now and has been largly replaced by SSH. But this tool is great for manually connection to and sending mail.

Essentially what we are about todo is what SMTP VM does when it needs to send mail to another domain. If for some reason you cant send mail to a certain domain (because you think you have been blacklisted) or you just want to check that mail is working then telnet can be used for this purpose.

What you need?

The best way to use this tool is by using the FQDN of the endpoint. This is found by using nslookup or dig etc. But you can use the IP address also. Just substitute IP address for FQDN in the commands.

Lets do it.

Get a command prompt up and type: telnet FQDN 25

The “25” is the listening port number of SMTP service.

If the end point is listening on that port you should get a welcome message like this:

220 server.domain.com Microsoft ESMTP MAIL Service, Version: 6.0.379
0.1830 ready at Sun, 7 Apr 2006 16:46:14 +0100


Now type “ehlo”
You should see this:

250- server.domain.com Hello [192.168.0.1]
250-TURN
250-SIZE
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-X-EXPS GSSAPI NTLM LOGIN
250-X-EXPS=LOGIN
250-AUTH GSSAPI NTLM LOGIN
250-AUTH=LOGIN
250-X-LINK2STATE
250-XEXCH50
250 OK

Notice the ESMTP in the 220 message? That means that the server accepts ESMTP commands. ESMPT uses Extended hello’s like “ehlo”. Exchange like other mail servers that support ESMTP will try the “ehlo” first and if they get the above response back then the server will use the ESMTP codes.


Now type “helo”

Server will now respond with: 250 server.domain.com Hello [192.168.0.1]

Notice now that all the Extended command are missing?



Right, lets get on…….

Type
mail from: someone@FQDN (your address)

This indicates the reply address. Some mail servers will compare the value in the square brackets [192.168.0.1) ehlo or helo command, and the domain listed in the address on the mail from: command to the domain name returned when performing a reverse DNS (RDNS) lookup on the IP address from which the message is coming. If they don’t match, then often you wont be able to go any further. Its anti spoofing protection.

If you are testing communications to an outside your domain, you may need to use your actual domain name to be allowed to continue.

Type
rcpt to:real.user@receivingdomain.com (the receiving domain)

This is the recipient address.

Type subject: Test message using Telnet

Type a blank line - this denotes the end of the subject and the beginning of the message body.

Type This is a test

Type a blank line
Type a dot (".") and press Enter - this marks the end of the message body. The receiving system will understand and return a prompt.
Type quit

This ends the Telnet session and you will be returned to the command prompt.

In theory that’s all you need to do. Apart from wait for the message to turn up.

Comments

Popular posts from this blog

Installation Prerequisite of SharePoint 2013 on Windows server 2012 R2

Server Error - 404 file or directory not found

OWA unable to login - Exception type: Microsoft.Exchange.Data.Storage.ConnectionFailedTransientException