ceo wrote:
>var_dump(imap_rfc822_parse_adrlist('"! # $ % &  * + - / = ? ^ _ ` { | } ~"', 
>''));
>This looks like a valid localhost email address to me...

It surely is a valid localhost email address, but what most people
(and the OP) usually need is to validate a full email string with a
local and a domain part.

What should be valid email addresses according to RFC 2822 [1]:
!#$%&*+-/=?^_`{|[EMAIL PROTECTED]
"@"@example.com

Not valid email addresses:
"\"@example.com
@@example.com
- [EMAIL PROTECTED]

Valid email addresses according to the Multipurpose Internet Mail
Extension (MIME) [2]:
[EMAIL PROTECTED]
[EMAIL PROTECTED]

So for people who got to write code that also works on PHP4 it is not
very easy to validate an email address.
Even nice regex attempts like [3] fail since more and more mail
servers support the MIME hieroglyphs.
That's why I was pretty excited about imap_rfc822_parse_adrlist(),
since it runs in PHP4 if installed.
Which clearly is no substitute for the PHP5+ filter functions [4].
If it's just my brain farting and there actually then tell me.

[1] http://www.faqs.org/rfcs/rfc2822.html
[2] http://en.wikipedia.org/wiki/MIME
[3] http://www.addedbytes.com/php/email-address-validation/
[4] http://in.php.net/filter

Reply via email to