check an email really exist

by Guna 2012-07-17 11:34:18

Hi,

There are lot of handy functions to check an email really exists or not. But here we are going to use

checkdnsrr(). This functions checks dns for the records of given type. Have a look at the code below.


function isValidEmail($email){
list($name, $domain)=explode('@',$email);
if(!checkdnsrr($domain,'MX'))
return false;

return true;
}

if(isValidEmail(example@hiox.org))
echo "Email id exists";
else
echo "Not a valid email";



By passing an email id to the above function it searches MX records of hiox.org, if the records exists then it returns true.

A short Note on MX RECORD:
A mail exchanger record (MX record) is a type of resource record in the Domain Name System that specifies a mail server responsible for accepting email messages on behalf of a recipient's domain.

Tagged in:

1086
like
0
dislike
0
mail
flag

You must LOGIN to add comments