How to check the email address is valid or not

Some times it will be necessary to verify the existence of email addresses. In such cases we can follow the following steps to check the same. Here I using gmail.com for explaining the details. Don't forget to replace this this with your required domain.


CASE1- For the case of a invalid gmail address invalidmail@gmail.com

Step1: Find the mail server of domain

#nslookup -q=mx gmail.com | grep 'mail exchanger' | awk {'print $6'}
gmail-smtp-in.l.google.com.
alt1.gmail-smtp-in.l.google.com.
alt2.gmail-smtp-in.l.google.com.
alt3.gmail-smtp-in.l.google.com.
alt4.gmail-smtp-in.l.google.com.

Step2: Connect to one of the mail server of the target domain.

#telnet alt1.gmail-smtp-in.l.google.com 25
Trying 74.125.192.27...
Connected to alt1.gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP j2si1019020qtb.124 - gsmtp
#helo gmail
250 mx.google.com at your service
#mail from: <youremail@domain.com>
250 2.1.0 OK j2si1019020qtb.124 - gsmtp
#rcpt to: <invalidmail@gmail.com>
550-5.1.1 The email account that you tried to reach does not exist. Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1 https://support.google.com/mail/?p=NoSuchUser j2si1019020qtb.124 - gsmtp
^]
telnet> q
Connection closed.



CASE2- For the case of a valid gmail address validmail@gmail.com

Step1: Find the mail server of domain

#nslookup -q=mx gmail.com | grep 'mail exchanger' | awk {'print $6'}
gmail-smtp-in.l.google.com.
alt1.gmail-smtp-in.l.google.com.
alt2.gmail-smtp-in.l.google.com.
alt3.gmail-smtp-in.l.google.com.
alt4.gmail-smtp-in.l.google.com.

Step2: Connect to one of the mail server of the target domain.

#telnet alt1.gmail-smtp-in.l.google.com 25
Trying 74.125.192.27...
Connected to alt1.gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP k9si1053537qte.22 - gsmtp
#helo gmail
250 mx.google.com at your service
#mail from: <youremail@domain.com>
250 2.1.0 OK k9si1053537qte.22 - gsmtp
#rcpt to: <validmail@gmail.com>
250 2.1.5 OK k9si1053537qte.22 - gsmtp
^]
telnet> q
Connection closed.


Note that hotmail does not allow these kinds of email verifications and so we will not get the exact result hotmail addresses.

Leave a Reply

Your email address will not be published. Required fields are marked *