How to check whether an e-mail address is valid? If it is, then check why it isn’t accepting email messages?

As a sysadmin, I have to check whether certain email addresses are valid.

This usually happens after a customer does not correctly type his/her e-mail address in the feedback form. Usually, a web search of the domain name solves the problem at this stage.
WEBPAGE-Goog-Search-Domain-auto-correction

Sometimes, it does happen that the domain exists but mail is still not getting sent. Then, the troubleshooting procedure is a bit more complicated.

First, query the domain’s mail server and then check with it whether the mailbox specified by the e-mail address exists. How do you do that?

  1. Use NSLOOKUP command to list the e-mail servers used by the domain. This is also popularly known as an MX query. If the e-mail address is somebody@example.com, then you would have to try:
    nslookup -query=mx example.com
    

    Gnome Terminal windows showing bash command nslookup doing an MX query for a domain.

    In Windows, the command is not much different. I think you may have to do:

    nslookup -q=mx example.com
    

    In the above screenshot, I have queried the e-mail domains of CIA (Unclassified CIA). Their mail servers are mail1.cia.gov and mail2.cia.gov.

  2. Use telnet to send mail to one of the mail servers listed by the nslookup command. The procedure is simple.
    1. Connect to port 25 (that’s the e-mail port).
      telnet mail1.example.com 25
      
    2. If the mail server responds with a “220” message, then introduce yourself with what would be your mail server. (You are pretending to be a mail server here. In this example, I fancy myself as mailserver.maahdomain.com but you need to use an existing mail server in your domain. Don’t get too smart here as sometimes, the mail server might terminate your connection then and there if it suspects that you are a spammer.)
      HELO mailserver.maahdomain.com
      
    3. If the mail server will responds with a “250” message, then specify what might be your or the sender’s e-mail address.
      MAIL FROM: somebody@maahdomain.com
      

      The space after “MAIL FROM:” is important and should not be missed.

    4. If the mail server responds with another “250” message, then specify the e-mail address that you need to check.
      RCPT TO: somebody@example.com
      

      Don’t forget the space after “RCPT TO:”.

    5. If the mail server responds with another “250”, then the e-mail address exists and you need not probe further. If the inbox is full or if the account is deleted or if there is some other problem, the mail server will tell you here. Whatever the case, just type QUIT and exit Telnet here.Using telnet in Gnome Terminal to send a email from bash." width="593" height="628" /> Using telnet in Gnome Terminal to send an email from bash.

      (Note: I have taken it further by sending a complete mail. YOU DON’T DO THAT. CIA sends me spam almost everyday and I feel I am allowed to do this for an illustration. Type QUIT or else your recipient may not like you.)

The telnet commands are the same in Windows too. They are not really telnet commands but MTA commands.

Also read:

  1. “10 years ago, Moral Volcano bust the CIA – https://moralvolcano.wordpress.com/2014/01/12/10-years-ago-moral-volcano-busted-the-cia/)
  2. CIA Iraqi Rewards Program (archived web page) – https://moralvolcano.wordpress.com/2004/07/03/cia-iraqi-rewards-program/
Advertisements

Comments on this blog are moderated by government agents. The Moral Volcano Essential Reading List will explain why.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s