I'm using PHP version 5.3.10. The following is the code:
<?php $email = "test@example.c"; if (filter_var($email, FILTER_VALIDATE_EMAIL)) echo "Email: ".$email." correct"; else echo "email not correct"; ?>
It returns: "Email: test@example.c is correct.
I think a one-character TLD is incorrect (according to this list: http://data.iana.org/TLD /tlds-alpha-by-domain.txt, I didn’t know there was a character-length top-level domain).
So, does the FILTER_VALIDATE_EMAIL filter work properly?
FILTER_VALIDATE_EMAIL does not support PHP 5.2.14
Verifying email addresses is a bit complicated. Take a look at this list:
Valid email address
Invalid email address
Source http://en.wikipedia.org/wiki/Email_address
Most all email validation implementations are "buggy", but the php implementation works fine since it accepts all common email addresses
renew:
Found on http://www.php.net/manual/en/filter.filters.validate.php
About the "partial" address that does not exist. In the domain section, a comment in the source code (in ext/filter/logical_filters.c) proves this rejection:
Here is a link to Michael Rushton's class (link is broken, see source code below) which supports RFC 5321/5322