After "ceo" posted about the imap function I was eager to try it out
and got rather disappointed pretty soon.
imap_rfc822_parse_adrlist() should not be used for email validation!

EXAMPLE:
<?php
var_dump(imap_rfc822_parse_adrlist('"! # $ % &  * + - / = ? ^ _ ` { |
} ~"', ''));
?>

The above code will output:

array(1) {
  [0]=>
  object(stdClass)(2) {
    ["mailbox"]=>
    string(36) "! # $ % &  * + - / = ? ^ _ ` { | } ~"
    ["host"]=>
    string(0) ""
  }
}

Although
"! # $ % &  * + - / = ? ^ _ ` { | } ~"@example.com
would be a valid email address!

Without the '@example.com' it is not.

Have a look at the user comments at [1], where one user has further examples.

[1] http://us.php.net/manual/en/function.imap-rfc822-parse-adrlist.php

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

Reply via email to