@example.com', false); // Disallowed Characters $tests[] = array('test@.', false); $tests[] = array('test@example.', false); $tests[] = array('test@.org', false); $tests[] = array('12345678901234567890123456789012345678901234567890123456789012345@example.com', false); // 64 characters is maximum length for local part. This is 65. $tests[] = array('test@123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012.com', false); // 255 characters is maximum length for domain. This is 256. $tests[] = array('test@[123.123.123.123', false); $tests[] = array('test@123.123.123.123]', false); foreach($tests as $test){ $info = 'Testing '.$test[0]; if($test[1]){ $this->assertTrue((bool) mail_isvalid($test[0]), $info); }else{ $this->assertFalse((bool) mail_isvalid($test[0]), $info); } } } } //Setup VIM: ex: et ts=4 :