|
|||||||
| PHP Discussion and technical support for using and deploying PHP based websites. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
PHP email validation...
I have seen many different ways to validate email addresses using PHP. There are many different approaches to this, but I want to implement the best one (I know PHP should be VERY thorough and client-side check be brief). I am confused as to which one out of the ones I have read about (PHP) is the best AND most thorough. Can someone please direct me to a site that has the best PHP email validation? Or can someone just send me the code directly please. Thanks in advance
.
|
|
#2
|
|||
|
|||
|
Quote:
Code:
if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){
return FALSE;
}
|
|
#3
|
||||
|
||||
|
If you are talking about verifying that the format is valid, the most thorough implementation I've seen is at http://www.iamcal.com/publish/articl...parsing_email/ (and the least likely not to give false negatives). If you are talking about verifying that it is an actual email address, the only foolproof way I know of is to send an email to it (such as is done when you sign up for a forum like this one and you have to click on a confirmation link).
__________________
"That's what the gods are! An answer that will do! Because there's food to be caught and babies to be born and life to be lived and so there is not time for big, complicated, and worrying answers! Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." -- from Nation, by Terry Pratchett freelancer.internet.com Email me |
|
#4
|
|||
|
|||
|
ahhh k... thanks... didn't know that the ONLY way to make sure email address EXISTS is to send it FIRST...
|
|
#5
|
||||
|
||||
|
There are ways to poll mail servers to verify an address, but you cannot count on them to always work, as not every mail server is configured to respond (for privacy or security reasons, for instance), and even if it is, there's always a possibility it could be temporarily down (or the network connection to it).
__________________
"That's what the gods are! An answer that will do! Because there's food to be caught and babies to be born and life to be lived and so there is not time for big, complicated, and worrying answers! Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." -- from Nation, by Terry Pratchett freelancer.internet.com Email me |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|