@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Improve correctness of email address escaping in Mailgun/Postmark

Summary: Ref T13053. Uses the changes in D19026 to escape mail addresses. Those rules may not be right yet, but they're at least all in one place, have test coverage, and aren't obviously incorrect.

Test Plan: Will vet this more extensively when re-testing all mailers.

Maniphest Tasks: T13053

Differential Revision: https://secure.phabricator.com/D19027

+6 -8
+3 -2
src/applications/metamta/adapter/PhabricatorMailImplementationAdapter.php
··· 96 96 97 97 protected function renderAddress($email, $name = null) { 98 98 if (strlen($name)) { 99 - // TODO: This needs to be escaped correctly. 100 - return "{$name} <{$email}>"; 99 + return (string)id(new PhutilEmailAddress()) 100 + ->setDisplayName($name) 101 + ->setAddress($email); 101 102 } else { 102 103 return $email; 103 104 }
+3 -6
src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
··· 21 21 if (empty($this->params['reply-to'])) { 22 22 $this->params['reply-to'] = array(); 23 23 } 24 - $this->params['reply-to'][] = "{$name} <{$email}>"; 24 + $this->params['reply-to'][] = $this->renderAddress($name, $email); 25 25 return $this; 26 26 } 27 27 ··· 110 110 } 111 111 112 112 $from = idx($this->params, 'from'); 113 - if (idx($this->params, 'from-name')) { 114 - $params['from'] = "\"{$this->params['from-name']}\" <{$from}>"; 115 - } else { 116 - $params['from'] = $from; 117 - } 113 + $from_name = idx($this->params, 'from-name'); 114 + $params['from'] = $this->renderAddress($from, $from_name); 118 115 119 116 if (idx($this->params, 'reply-to')) { 120 117 $replyto = $this->params['reply-to'];