php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64981 Email with multiple period in a row fail
Submitted: 2013-06-06 20:33 UTC Modified: 2015-03-20 01:41 UTC
Votes:4
Avg. Score:3.8 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: fillmorejd at gmail dot com Assigned:
Status: Not a bug Package: Filter related
PHP Version: 5.4.15 OS: Mac Mountain Lion
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
25 - 22 = ?
Subscribe to this entry?

 
 [2013-06-06 20:33 UTC] fillmorejd at gmail dot com
Description:
------------
Email with multiple period in a row fail validation when they are working email.  
With gmail you can add periods into any email address and it will still deliver.  
I use this to filter out messages.  example@gmail.com is the same as 
exam.....ple@gmail.com  or exam.ple@gmail.com or exam.p.l.e@gmail.com.

With one period or if there is a letter or number between period the 
FILTER_VALIDATE_EMAIL works just fine but if more than one period it fails. 

Test script:
---------------
<?php
$email_a = 'exmple@gmail.com';
$email_b = 'exm.a.p.le@gmail.com';
$email_c = 'exa......mple@gmail.com';

if (filter_var($email_a, FILTER_VALIDATE_EMAIL)) {
    echo "This ($email_a) email address is considered valid.\n";
} else {
    echo "$email_a failed\n";
}

if (filter_var($email_b, FILTER_VALIDATE_EMAIL)) {
    echo "This ($email_b) email address is considered valid.\n";
} else {
    echo "$email_b failed\n";
}

if (filter_var($email_c, FILTER_VALIDATE_EMAIL)) {
    echo "This ($email_c) email address is considered valid.\n";
} else {
    echo "$email_c failed\n";
}

Expected result:
----------------
This (exmple@gmail.com) email address is considered valid.
This (exm.a.p.le@gmail.com) email address is considered valid.
This (exa......mple@gmail.com) email address is considered valid.

Actual result:
--------------
This (exmple@gmail.com) email address is considered valid.
This (exm.a.p.le@gmail.com) email address is considered valid.
exa......mple@gmail.com failed

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-19 19:52 UTC] mail+php at requinix dot net
Multiple consecutive periods in normal email addresses really is invalid. The fact 
that Gmail supports it does not make it valid.

Both RFC 5321 (SMTP) and 5322 (Internet Message Format) paraphrased say:
  addr-spec = dot-atom "@" domain
  dot-atom = atext+ ("." atext+)*
  atext = letters | digits | some symbols not including "."
 [2015-03-20 01:32 UTC] ppaisndud at gmail dot com
local-part = dot-atom / quoted-string / obs-local-part dot-atom = [CFWS] dot-atom-text [CFWS] dot-atom-text = 1*atext *("." 1*atext) quoted-string = [CFWS] DQUOTE *([FWS] qcontent) [FWS] DQUOTE [CFWS] obs-local-part = word *("." word) word = atom / quoted-string atom = [CFWS] 1*atext [CFWS]
RFC 5322 section 3.4.1
domain = dot-atom / domain-literal / obs-domain dot-atom = [CFWS] dot-atom-text [CFWS] dot-atom-text = 1*atext *("." 1*atext)
RFC 5322 section 3.4.1
Domain = sub-domain *("." sub-domain)
RFC 5321 section 4.1.2

from http://isemail.info/exa......mple%40gmail.com
believe this can be closed
 [2015-03-20 01:41 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2015-03-20 01:41 UTC] requinix@php.net
Tsk tsk, Gmail.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 10:01:29 2024 UTC