|
Posted by "Ben Litton" on 10/24/05 19:19
You could certainly write an extension to do so. That's what I did (mostly
I was writing one for another purpose and added a function I stole from
O'Reilly. You can find the C code I used here:
http://www.oreillynet.com/pub/a/network/excerpt/spcookbook_chap03/index3.html.
It's pretty clever (If you're used to doing things the PHP/regex way) and
while I haven't benchmarked it, I'd imagine it is pretty fast.
There are lots of php extension tutorials out there, but if you want me to
wrap it for you I probably could. I'm sure though that the many php regex
solutions out there are probably 'good enough' for your needs, and I
haven't tested that C code on some of the stranger e-mail addresses out
there in existance.
Ben
On Fri, 21 Oct 2005 22:58:38 -0400, "Richard Lynch" <ceo@l-i-e.com> wrote:
> Given:
>
> It is unacceptable to reject perfectly valid email addresses, no
> matter how arcane. [Like mine. :-)]
>
> The CORRECT RegEx for validating an email is 3 pages long, and
> performance in PHP would probably not be so good...
>
> In today's Security-conscious world, data validation is a requirement.
>
> The (relatively) recent changes in domain names that allow UTF
> (Unicode?) characters.
>
> Checking MX records is not reliable at all.
>
> Forcing users to respond to email is A) burdensome to real users in
> many cases, and B) no real barrier to halfway intelligent fake users.
>
> ... would it not make sense for there to be a BUILT-IN PHP function of
> a TRUE email syntactic validation?
>
> So at least one KNOWS that the email is a valid construct, before you
> even try (if you try at all) to make sure that a person actually
> checks it at least once in their life.
>
> Currently, email syntax validation is being done in very limited
> fashion, if not outright "wrong" by rejecting what actually ARE valid
> email addresses in about 10,000,000 PHP scripts by users who don't
> have any realistic options to truly "do it right" because who can
> really live with that 3-page Regex in their PHP code?
>
> Yes, in the past, I may have come down squarely on the opposite side
> of this topic, but I've changed my mind.
>
> I believe PHP needs a built-in syntactically CORRECT email validation
> function, vetted and tested by professionals, instead of the mess we
> now have.
>
> PLEASE do not point me to any existing email validation code unless
> you believe it is not only 100% correct and complete with RFC
> definitions of syntactically valid email. Not interested. I've
> already seen them, and been burned by them.
>
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
[Back to original message]
|