Wednesday, July 17, 2013

Test Email flow using SMTP commands, nslookup, ehlo, helo, troubleshooting mailflow

 
How_tos

Test Email flow using SMTP commands

165
 
 
Spiciness

Steps

Often you need to test email and if it's working. With these commands you can test email flow at a very granular level to determine what's broken and where.
Scenario:
Your domain: mydomain.com
Domain you wish to send to: theirdomain.com


1.

Determine the mail server you're sending to.

* Open a CMD prompt
* Type NSLOOKUP
> set q=mx
> theirdomain.com
Response:
Non-authoritative answer:
theirdomain.com MX preference = 50, mail exchanger = mail.theirdomain.com




Nslookup_big
2.

Connect to their mail server

SMTP communicates over port 25. We will now try to use TELNET to connect to their mail server "mail.theirdomain.com"
* Open a CMD prompt
* TELNET MAIL.THEIRDOMAIN.COM 25
You should see something like this as a response:
220 mx.google.com ESMTP 6si6253627yxg.6
Be aware that different servers will come up with different greetings but you should get SOMETHING. If nothing comes up at this point there are 2 possible problems. Port 25 is being blocked at your firewall, or their server is not responding. Try a different domain, if that works then it's not you.


Telnet_begin_big
3.

Send an Email

Now, use simple SMTP commands to send a test email. This is very important, you CANNOT use the backspace key, it will work onscreen but not be interpreted correctly. You have to type these commands perfectly.
ehlo mydomain.com
mail from:<martin9700@mydomain.com>
rcpt to:<recipient@theirdomain.com>
data
This is a test, please do not respond
.
quit

So, what does that all mean?
EHLO - introduce yourself to the mail server HELO can also be used but EHLO tells the server to use the extended command set (not that we're using that).
MAIL FROM - who's sending the email. Make sure to place this is the greater than/less than brackets as many email servers will require this (Postini).
RCPT TO - who you're sending it to. Again you need to use the brackets. See Step #4 on how to test relaying mail!
DATA - tells the SMTP server that what follows is the body of your email. Make sure to hit "Enter" at the end.
. - the period alone on the line tells the SMTP server you're all done with the data portion and it's clear to send the email.
quit - exits the TELNET session.


Telnet_session_big
4.

Test SMTP relay

Testing SMTP relay is very easy, and simply requires a small change to the above commands. See below:
ehlo mydomain.com
mail from:<martin9700@mydomain.com>
rcpt to:<recipient@someotherdomain.com>
data
This is a test, please do not respond
.
quit
See the difference? On the RCPT TO line, we're sending to a domain that is not controlled by the SMTP server we're sending to. You will get an immediate error is SMTP relay is turned off. If you're able to continue and send an email, then relay is allowed by that server.

Source: http://community.spiceworks.com/how_to/show/11-test-email-flow-using-smtp-commands

1 comment:

  1. You may get a request or two. Be that as it may, in the event that you will purchase costly booklets, be certain you are offering something NEW something which EVERY mail request seller has not as of now seen at any rate multiple times! instant sales leads

    ReplyDelete