Using the examples of 'valid' and 'invalid' on the Wikipedia page:
http://en.wikipedia.org/wiki/Email_address
Result 3 and 5 should have been valid, but they are not. Below is the code used
to test.
<?php
require_once('php/EmailAddressValidator.php');
$emailList = array('niceandsimple@example.com',
'a.little.unusual@example.com',
'a.little.more.unusual@dept.example.com',
'much."more\ unusual"@example.com',
'very.unusual."@".unusual.com@example.com',
'very."(),:;<>[]".VERY."very@\\\ \"very".unusual@strange.example.com',
'Abc.example.com',
'Abc.@example.com',
'Abc..123@example.com',
'A@b@c@example.com',
'a"b(c)d,e:f;g<h>i[j\k]l@example.com',
'just"not"right@example.com',
'this is"not\allowed@example.com',
'this\ still\"not\\allowed@example.com',
'a.final@test.com, should@fail.com');
$eValid = new EmailAddressValidator;
foreach($emailList as $k => $v) {
if ($eValid->check_email_address($v)) {
echo $k.'. valid: '.$v.'<br />';
} else {
echo $k.'. NOT valid: '.$v.'<br />';
}
}
?>
And the results are:
0. valid: niceandsimple@example.com
1. valid: a.little.unusual@example.com
2. valid: a.little.more.unusual@dept.example.com
3. NOT valid: much."more\ unusual"@example.com
4. valid: very.unusual."@".unusual.com@example.com
5. NOT valid: very."(),:;<>[]".VERY."very@\\ \"very".unusual@strange.example.com
6. NOT valid: Abc.example.com
7. NOT valid: Abc.@example.com
8. NOT valid: Abc..123@example.com
9. NOT valid: A@b@c@example.com
10. NOT valid: a"b(c)d,e:f;gi[j\k]l@example.com
11. NOT valid: just"not"right@example.com
12. NOT valid: this is"not\allowed@example.com
13. NOT valid: this\ still\"not\allowed@example.com
14. NOT valid: a.final@test.com, should@fail.com
Original issue reported on code.google.com by tigger...@gmail.com on 12 Jan 2012 at 12:05
Original issue reported on code.google.com by
tigger...@gmail.com
on 12 Jan 2012 at 12:05