mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Properly parse email replies with varied 'To' address formats
Summary: While my client and some others send email replies with an address like ##T1+x+y@example.com##, some other clients have sent either ##<T1+x+y@example.com>## or ##"T1+x+y@example.com" <T1+x+y@example.com>##. Properly parse all the formats we've seen in the wild. Test Plan: Ran the regexp against all the formats observed in the wild (see https://secure.phabricator.com/mail/received/) and verified it parses them correctly. Reviewed By: jungejason Reviewers: tuomaspelkonen, jungejason, aran CC: anjali, aran, jungejason Differential Revision: 370
This commit is contained in:
parent
0238f260df
commit
0cdf4c2518
1 changed files with 4 additions and 1 deletions
|
@ -39,9 +39,12 @@ class PhabricatorMetaMTAReceivedMail extends PhabricatorMetaMTADAO {
|
|||
public function processReceivedMail() {
|
||||
$to = idx($this->headers, 'to');
|
||||
|
||||
// Accept a match either at the beginning of the address or after an open
|
||||
// angle bracket, as in:
|
||||
// "some display name" <D1+xyz+asdf@example.com>
|
||||
$matches = null;
|
||||
$ok = preg_match(
|
||||
'/^((?:D|T)\d+)\+(\d+)\+([a-f0-9]{16})@/',
|
||||
'/(?:^|<)((?:D|T)\d+)\+(\d+)\+([a-f0-9]{16})@/U',
|
||||
$to,
|
||||
$matches);
|
||||
|
||||
|
|
Loading…
Reference in a new issue