I’d like to talk quickly about a great and underutilized method for troubleshooting email flow problems. Today I had to rebuild an Exchange Hub Transport server after a slight catastrophe from last week in which the VM the Hub lived on was completely unrecoverable. That is another story but it brings up the need for using a great tool that is often skipped over, and that is sending test email via telnet.
The reason I say that this method is underutilized is because, well who uses telnet these days? What’s great about using this is that you can test different aspects and essentially pinpoint where mail flow issues are occurring. In my case I was have trouble relaying email from an internal account to outside mail servers. So let’s jump into how to use this tool, its easy but I feel like not enough people know about it, so here we go.
First, since I was testing from inside, I need to connect to the local server name.
telnet hubserver.psa.local 25
Easy enough, we are using telnet to connect to the hub server, hubserver.psa.local on port 25 (SMTP). Once we get in we run a simple,
That gives us back a little bit of information, basically telling us that this is an email server and some of its capabilities. Next, we will need to run through the following set of commands to send out the test email. It is important that these commands are entered in exactly, with no backspaces, otherwise it will break the command and you will get an error message spit back out from your telnet session.
MAIL FROM: [email protected] RCPT TO: [email protected] DATA SUBJECT: message content. . QUIT
- MAIL FROM: This is telling the mail server who this message is being sent from.
- [email protected] is the internal mail sender I was using.
- RCPT TO: Tells the mail server the email address that is being sent to.
- [email protected] is the address we are sending to. It can be any of your internet based mail addresses (google, yahoo, etc.).
- DATA signifies the start of the message body.
- SUBJECT: This line is optional, probably a good idea to include a subject so the message doesn’t get blocked or sent to spam. Hit enter twice after this to drop into the message content.
- message content is whatever you want to include in your message. Follow your message by hitting enter.
- “.” (read dot) on a line by itself will tell the mail server to end the message and send it. It is basically the equivalent of an escape character for emails.
- QUIT leaves the telnet session from the mail server.
It is important that the previous set of commands is run the way that they look. This whole string of commands should look something similar to the following inside of your shell when things are all said and done, assuming everything is working properly.
In my case, I was unable to enter an address for the
RCPT TO: command. To fix this, among with a few other steps in rebuilding the hub was to grant anonymous send permission on the Exchange side of things, then after that mail began flowing through the newly rebuilt Hub Transport server perfectly.
That should be it, I highly suggest going through the process of sending out a few test emails to get this method stuck in your brain for later on down the road if you ever have to do any mail flow type troubleshooting. Good luck!