Validate Real Email Address Using MX record

Validate Real Email Address Using MX record? send test mail to that real email address and if your message doesn’t bounce and it is safe to assume* that the address is real email address.

1.Ping an Email Address to Validate it! 

When you send an email to someone, the email message goes first to an SMTP server which then looks for the MX (Mail Exchange) records of the email recipient’s domain.

2.Enable telnet in Windows. Or if you already have the PuTTY utility, skip this step.

3.Open the command prompt and type the following command:

nslookup –type=mx gmail.com
This command will extract and list the MX records of a domain as shown below. Replace gmail.com with the domain of the email address that you are trying to verify.

gmail.com MX preference=30, exchanger = alt3.gmail-smtp-in.l.google.com
gmail.com MX preference=20, exchanger = alt2.gmail-smtp-in.l.google.com
gmail.com MX preference=5, exchanger = gmail-smtp-in.l.google.com
gmail.com MX preference=10, exchanger = alt1.gmail-smtp-in.l.google.com
gmail.com MX preference=40, exchanger = alt4.gmail-smtp-in.l.google.com

a: Connect to the mail server:

telnet gmail-smtp-in.l.google.com 25
b: Say hello to the other server

HELO
c: Identify yourself with some fictitious email address

mail from:<info@smartwebtutorials.com>

d: Type the recipient’s email address that you are trying to verify:

rcpt to:<abc123@gmail.com>

The server response for ‘rcpt to’ command will give you an idea whether an email address is valid or not. You’ll get an “OK” if the address exists else a 550 error like:

abc@gmail.com — The email account that you tried to reach does not exist.
support@gmail.com — The email account that you tried to reach is disabled.
That’s it! If the address is valid, you may perform a reverse email search to find the person behind the address

MX records to validate email addresses

function MXRecordVerify($emailaddress){
        list($user, $domain) = explode('@', $emailaddress);
        $arr= dns_get_record($domain,DNS_MX);
        if($arr[0]['host']==$domain&&!empty($arr[0]['target'])){
                return $arr[0]['target'];
        }
}
$emailaddress= 'info@smartwebtutorials.com';

if(MXRecordVerify($emailaddress)) {
        echo('This MX records exists; I will accept this email as valid.');
}
else {
        echo('No MX record exists;  Invalid email.');


Leave a Reply

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