1

I've found a couple online services that do this, and I found this post at stackoverflow about it:

How to check if an email address exists without sending an email?

The problem is that the PHP script linked to there requires you to populate a list of nameservers and domains, and thus (I think) only works if you are validating emails on a known domain. I want something that will work for any email (at least work with a high probability). I found a script that does it that I can buy for $40, but I'd rather find the same thing as open source.

Thanks for any advice, Jonah

Community
  • 1
  • 1
Jonah
  • 15,806
  • 22
  • 87
  • 161
  • 2
    You can't verify an email with 100% accuracy without sending a confirmation. – Mike Caron Feb 28 '11 at 21:40
  • I concur. If the methods described in your link were supported generally, we would be in deep $!?^ since spammers can do the same with our email addies... – Gelmir Feb 28 '11 at 21:49
  • ummmm.... can someone tell me what happened to the other answer posted here by Christopher yesterday? It appears to have been deleted. Why would this be? – Jonah Mar 01 '11 at 16:27

1 Answers1

0

This:

$emailValidation = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/;

if(preg_match($emailValidation, $testEmail)) {
    echo "valid email.";
} else {
    echo "invalid email.";
}

Is a well used email validation regex, which is PHP compatible.

Just check email addresses against it and you're done.

But note that without a confirmation postback you will never know that an email is 100% valid.

ocodo
  • 29,401
  • 18
  • 105
  • 117