Jump to content

How to validate an email? i nid your help T.T


avigail

Recommended Posts

how will i know if the email address entered by the user when he/she registered is a valid email. ? if that email is also registered for example in yahoo, gmail,etc. . and it will return false if it is not registered.. i want to have the exact code for  this.. i hope that you will reply to this message..  :confused:

The short answer is that you can't tell.  Otherwise spammers would abuse this to find valid email addresses.

 

You can check if an email looks valid, and you can try sending an email to that address and see what happens.  If you really need valid email addresses, send an activation email with a unique link and ask the owner to follow the link.

If you are using PHP 5 >= 5.2.0 you could use filter_var() http://fi2.php.net/manual/en/function.filter-var.php with a flag FILTER_VALIDATE_EMAIL. Or if you need to validate it more specifically then maybe using regexp is the way. But as btherl already said, its super hard to try to validate emails in all cases. Either you let in some false emails or you end up blocking valid emails or both. As mentioned the activation link method is most bulletproof.

Archived

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

×
×
  • Create New...

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.