Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Problems with mailadress parsing #127

Open
Baztey opened this issue Dec 21, 2016 · 2 comments
Open

Problems with mailadress parsing #127

Baztey opened this issue Dec 21, 2016 · 2 comments

Comments

@Baztey
Copy link

Baztey commented Dec 21, 2016

Example Email-header:
"Foo <bar" foo.bar@test.com

Description:
The example email-header should be valid according to https://tools.ietf.org/html/rfc2822#section-3.4 but the function AdressList.php/addFromString matches it incorrect. The result has the following form:
"bar <foo.bar@test.com"
This is clearly not a valid adress and therefore causes exceptions in the following code

Solution:
Changing the regex in the addFromString function from lazzy to greedy by removing "?" from the named capture group "name"

  • old: ^((?P.*?)<(?P[^>]+)>|(?P.+))$
  • new: ^((?P.*)<(?P[^>]+)>|(?P.+))$
glensc added a commit to eventum/zend-mail that referenced this issue May 14, 2017
Example Email-header:
  "Foo <bar" <foo.bar@test.com>

Description:
   The example email-header should be valid
   according to https://tools.ietf.org/html/rfc2822#section-3.4
   but the function AdressList.php/addFromString matches it incorrect.
   The result has the following form:
    "bar <foo.bar@test.com"
   This is clearly not a valid adress and therefore causes
   exceptions in the following code

zendframework#127
@glensc
Copy link
Contributor

glensc commented May 14, 2017

@Baztey created PR based on your comments, including tests:
#143

however, it needs more fixes, because encoding back creates invalid result.

btw, your bugreport here has lost <>, use markdown code blocks to preserve them.

Ocramius pushed a commit that referenced this issue Mar 1, 2018
Example Email-header:
  "Foo <bar" <foo.bar@test.com>

Description:
   The example email-header should be valid
   according to https://tools.ietf.org/html/rfc2822#section-3.4
   but the function AdressList.php/addFromString matches it incorrect.
   The result has the following form:
    "bar <foo.bar@test.com"
   This is clearly not a valid adress and therefore causes
   exceptions in the following code

#127
@michalbundyra
Copy link
Member

This repository has been closed and moved to laminas/laminas-mail; a new issue has been opened at laminas/laminas-mail#45.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants