Page MenuHomePhabricator

D19027.id45625.diff
No OneTemporary

D19027.id45625.diff

diff --git a/src/applications/metamta/adapter/PhabricatorMailImplementationAdapter.php b/src/applications/metamta/adapter/PhabricatorMailImplementationAdapter.php
--- a/src/applications/metamta/adapter/PhabricatorMailImplementationAdapter.php
+++ b/src/applications/metamta/adapter/PhabricatorMailImplementationAdapter.php
@@ -96,8 +96,9 @@
protected function renderAddress($email, $name = null) {
if (strlen($name)) {
- // TODO: This needs to be escaped correctly.
- return "{$name} <{$email}>";
+ return (string)id(new PhutilEmailAddress())
+ ->setDisplayName($name)
+ ->setAddress($email);
} else {
return $email;
}
diff --git a/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php b/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
--- a/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
+++ b/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
@@ -21,7 +21,7 @@
if (empty($this->params['reply-to'])) {
$this->params['reply-to'] = array();
}
- $this->params['reply-to'][] = "{$name} <{$email}>";
+ $this->params['reply-to'][] = $this->renderAddress($name, $email);
return $this;
}
@@ -110,11 +110,8 @@
}
$from = idx($this->params, 'from');
- if (idx($this->params, 'from-name')) {
- $params['from'] = "\"{$this->params['from-name']}\" <{$from}>";
- } else {
- $params['from'] = $from;
- }
+ $from_name = idx($this->params, 'from-name');
+ $params['from'] = $this->renderAddress($from, $from_name);
if (idx($this->params, 'reply-to')) {
$replyto = $this->params['reply-to'];

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 11:42 PM (21 h, 51 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6810877
Default Alt Text
D19027.id45625.diff (1 KB)

Event Timeline