1

I have the following code which (I think) will only verify the domain of the email address.

$EmailAddress = "user@domain.com";

list($User, $Domain) = explode("@", $EmailAddress);
$DomainExists = checkdnsrr($Domain, 'MX');
if($DomainExists==true){
    // Email domain exists
}
else{
    // Email domain does not exist
}

If I can, how do I verify the $User part?

Will
  • 19,661
  • 7
  • 47
  • 48
  • possible duplicate of [How to verify if a email address exists?](http://stackoverflow.com/questions/2750175/how-to-verify-if-a-email-address-exists) – Quentin Feb 13 '11 at 16:04
  • possible duplicate of [How to know if an email address exist through PHP?](http://stackoverflow.com/questions/4239533/how-to-know-if-an-email-address-exist-through-php) – Gordon Feb 13 '11 at 16:08
  • @Willian — the answer is still the same, the problem is language independent. – Quentin Feb 13 '11 at 16:25

2 Answers2

5

The only guaranteed way to make sure user@example.com exists is sending them an e-mail with a verification link.

Here's another post on how to do that: Easiest way for PHP email verification link

Community
  • 1
  • 1
5

The only way you can tell if an email address exists is to send email to it with a task for the user to perform (usually clicking on a link), for the email not to be caught in spam filters, and for the recipient to perform the task.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335