Jump to content

Archived

This topic is now archived and is closed to further replies.

Xurion

Detecting if an email is genuine

Recommended Posts

If I have an email address field that the user fills in, what is the best way to detect if that email is real?

Do I simply detect if there is an @ symbol there? Or is there another way to detect if it is genuine?

Thx in advance  :)

Share this post


Link to post
Share on other sites
Here is what I use, most of the time:

[code]
$email = $_POST['email'];
$regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]{1,})*\.([a-z]{2,}){1}$";
if (!eregi($regex,$email)) {
  echo "Invalid Email!";
}
else {
  //do whatever
}
[/code]

Share this post


Link to post
Share on other sites
Do you mean something like:

[code]
if (empty($_POST['email'])) {
  echo "No email was entered";
}
else {
  //do whatever
}
[/code]
?

Share this post


Link to post
Share on other sites
nope i mean how can you check if the domain entered really exist

ex. vbnullchar@yahoo.com <- this is existing
someone@somewhere.com <- can u determine if somewhere.com really exist..

Share this post


Link to post
Share on other sites
Yes, you can attempt to resolve the name first by performing an MX Lookup.

For further details try googling [url=http://www.google.co.uk/search?hl=en&q=%22Validate+email%22+%2Blookup&btnG=Search&meta=]"Validate Email" +Lookup[/url]

Regards
Huggie

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.