Edit report at http://bugs.php.net/bug.php?id=49576&edit=1
ID: 49576
Comment by: michael at squiloople dot com
Reported by: mparkin at de-facto dot com
Summary: Filter var for validating email is not validating
emails correctly
Status: Feedback
Type: Feature/Change Request
Package: *General Issues
Operating System: *
PHP Version: 5.*
Assigned To: rasmus
Block user comment: N
New Comment:
You might find this useful, taken directly from my article on E-mail
address
validation, in deciding whether or not to allow single-label domain
names:
"There is some confusion over whether or not single-label domain names
are
allowed â mich...@squiloople, for example. People often cite the
following
section in RFC 5321 to argue that they are not allowed:
"'Only resolvable, fully-qualified domain names (FQDNs) are permitted
when
domain names are used in SMTP. In other words, names that can be
resolved to MX
RRs or address (i.e., A or AAAA) RRs (as discussed in Section 5) are
permitted,
as are CNAME RRs whose targets can be resolved, in turn, to MX or
address RRs.
Local nicknames or unqualified names MUST NOT be used.'
"The implicit premise here is that TLD-only domain names cannot be
resolved to
MX RRs. This is simply untrue: both checkdnsrr('ai', 'MX') and
getmxrr('ai',
$array) return true, showing that single-label domain names can, and do,
resolve
to MX RRs. Additionally, http://www.to/ is a valid, and active, domain.
Therefore, mich...@squiloople is valid (although in this example,
âsquiloopleâ
is not a TLD).
"And as an extra note, hereâs another excerpt from RFC 5321:
"'In the case of a top-level domain used by itself in an email address,
a single
string is used without any dots.'"
Previous Comments:
------------------------------------------------------------------------
[2010-08-15 02:09:23] [email protected]
Have you tried with 5.2.14 or 5.3.3?
------------------------------------------------------------------------
[2010-08-14 21:10:33] grangeway at hotmail dot com
Additionally:
1) at the moment, I believe the current regex does not allow f...@com as
an
email address. Albeit, it's going back almost 10 years now - I'm pretty
sure I
received an email from someone @tld, complaining that a regex did not
allow
their valid email address to sign up.
2) The issue the user hit is the phpmailer class contains the following
code to
validate email addresses against FILTER_VALIDATE_EMAIL regardless of
whether
SMTP or mail() is the sending method.
550 public static function ValidateAddress($address) {
551 if (function_exists('filter_var')) { //Introduced in PHP 5.2
...
else
regex
------------------------------------------------------------------------
[2010-08-14 20:48:24] [email protected]
Re-opened, the last comment seems quite valid to me, don't you think so
Rasmus?
------------------------------------------------------------------------
[2010-08-05 16:41:58] alexsander dot rosa at gmail dot com
The format "usern...@box" for local networks IS allowed when the mail()
method is used. I quote RFC 5321: "local aliases MUST NOT appear in any
SMTP transaction." They say NOTHING about mail() method in the RFC.
------------------------------------------------------------------------
[2010-04-02 19:57:45] [email protected]
A much better RFC-compliant regex has been committed now.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=49576
--
Edit this bug report at http://bugs.php.net/bug.php?id=49576&edit=1