RE: Validating Email Conditional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You could also consider:
http://www.php.net/manual/en/function.imap-rfc822-parse-adrlist.php

Assuming that the PHP/IMAP Developers who wrote that function actually
know what they are doing and did the regex right... :-)

This saves trying to send out a billion confirmation emails to totally
bogus addresses that could never possibly work, if you are being
pounded by some idiot spam bot script.

I'm NOT claiming it's perfect (read the user contributed notes) but it
sure beats any home-brew Regex pattern anybody on this list can come
up with. :-)

On Fri, August 3, 2007 10:57 am, bruce wrote:
> hey...
>
> there are reasonable perl based solutions to the email address
> validation
> issue.
>
> if you're willing to call the perl function, you can let it do the
> heavy
> lifting. however, there's no way you're going to have a 5-10 line
> regex be
> able to accommodate all the email address nuances..
>
> processing of email addresses should really be done by doing a good
> verification, and then doing the live email check by sending the
> confirmation...
>
> my $0.02 worth...
>
> peace
>
>
> -----Original Message-----
> From: Robin Vickery [mailto:robinv@xxxxxxxxx]
> Sent: Friday, August 03, 2007 12:59 AM
> To: PHP General List
> Cc: CK
> Subject: Re:  Validating Email Conditional
>
>
> On 02/08/07, CK <ck@xxxxxxxxxxxxxxx> wrote:
>> Hi
>>
>> Please see the notes below keeping in mind this RegEX is being used
>> to validate emails for a newsletter signup form. It may not be
>> possible, accommodating some of the formats you provided. If you
>> have
>> the "Holy Grail" of RegEx please share.
>
> Can you reply to the list please?
>
> It's exactly the kind of situation that's most annoying - when you try
> and sign up for a
> newsletter or register with a site and it refuses to let you because
> it reckons your email address is invalid, despite the fact you've been
> sending and receiving mail with it for years.
>
> The best advice for validating email addresses is don't do it with a
> regexp. Send an email to the address with a link in it for them to
> confirm their registration.
>
>> On Aug 1, 2007, at 11:08 PM, Robin Vickery wrote:
>>
>> > On 02/08/07, CK <ck@xxxxxxxxxxxxxxx> wrote:
>> >> Hi,
>> >>
>> >> Would you point out why?  As I've tested a range of email
>> address,
>> >> and have not found one rejected that is formatted correctly.
>> >
>> > ok, here's a few perfectly valid email addresses off the top of my
>> > head. The first one's especially annoying as I use it a lot. The
>> last
>> > one's not so common but can be useful if you've got broken dns.
>> >
>> > robinv+php@xxxxxxxxx
>> (would you give a hand in accommodating this format?)
>
> Yeah, get rid of the regexp completely. Simple eh?
>
>> > name@xxxxxxxxxxxxxx
>> (should be invalid as the domain does not exist)
>
> Of course it doesn't - it's an example. that's why
>  the example.museum domain is reserved - to
> use in examples like this.
>
> The point is your regexp won't let anyone with
> a perfectly valid .museum (or .travel) domain
> register with your newsletter.
>
>> > o'reilly@xxxxxxxxxxx
>> (should be invalid as the domain does not exist)
>
> Of course it doesn't - it's an example. that's why
>  the example.com domain is reserved - to use in
> examples like this.
>
> The point is that your regexp won't allow anyone
> with an apostrophe in their name: o'reilly, o'rourke, o'malley etc.
>
>>
>> > name@[127.0.0.1]
>> (would you give a hand in accommodating this format?)
>
> -robin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux