diff --git a/CHANGELOG b/CHANGELOG index 3e41db41b5..ab5ebe8b01 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,10 @@ This is not a complete list of changes, just of API or workflow changes that may break existing installs. Newer changes are listed at the top. If you pull new changes and things stop working, check here first! +May 10 2011 - PhabricatorMailImplementationAdapter + The signatures of setFrom() and addReplyTo() have changed, and they now + accept a second "$name = ''" parameter. This represents a human-readable + name component of the address. May 9 2011 - git submodule As of commit 2a39fd0, you must run "git submodule update --init" in your @@ -9,4 +13,4 @@ May 9 2011 - git submodule commit for details. May 9 2011 - Changelog - Created CHANGELOG \ No newline at end of file + Created CHANGELOG diff --git a/src/applications/metamta/adapter/base/PhabricatorMailImplementationAdapter.php b/src/applications/metamta/adapter/base/PhabricatorMailImplementationAdapter.php index e00e99b2e2..3d20f53d6d 100644 --- a/src/applications/metamta/adapter/base/PhabricatorMailImplementationAdapter.php +++ b/src/applications/metamta/adapter/base/PhabricatorMailImplementationAdapter.php @@ -18,8 +18,8 @@ abstract class PhabricatorMailImplementationAdapter { - abstract public function setFrom($email); - abstract public function addReplyTo($email); + abstract public function setFrom($email, $name = ''); + abstract public function addReplyTo($email, $name = ''); abstract public function addTos(array $emails); abstract public function addCCs(array $emails); abstract public function addHeader($header_name, $header_value); diff --git a/src/applications/metamta/adapter/phpmailerlite/PhabricatorMailImplementationPHPMailerLiteAdapter.php b/src/applications/metamta/adapter/phpmailerlite/PhabricatorMailImplementationPHPMailerLiteAdapter.php index c17ca045e2..ceee9c0534 100644 --- a/src/applications/metamta/adapter/phpmailerlite/PhabricatorMailImplementationPHPMailerLiteAdapter.php +++ b/src/applications/metamta/adapter/phpmailerlite/PhabricatorMailImplementationPHPMailerLiteAdapter.php @@ -30,13 +30,13 @@ class PhabricatorMailImplementationPHPMailerLiteAdapter return true; } - public function setFrom($email) { - $this->mailer->SetFrom($email, '', $crazy_side_effects = false); + public function setFrom($email, $name = '') { + $this->mailer->SetFrom($email, $name, $crazy_side_effects = false); return $this; } - public function addReplyTo($email) { - $this->mailer->AddReplyTo($email); + public function addReplyTo($email, $name = '') { + $this->mailer->AddReplyTo($email, $name); return $this; } diff --git a/src/applications/metamta/adapter/test/PhabricatorMailImplementationTestAdapter.php b/src/applications/metamta/adapter/test/PhabricatorMailImplementationTestAdapter.php index 86c3518570..abf99bf0ef 100644 --- a/src/applications/metamta/adapter/test/PhabricatorMailImplementationTestAdapter.php +++ b/src/applications/metamta/adapter/test/PhabricatorMailImplementationTestAdapter.php @@ -30,13 +30,20 @@ class PhabricatorMailImplementationTestAdapter $this->config = $config; } - public function setFrom($email) { + public function setFrom($email, $name = '') { $this->guts['from'] = $email; + $this->guts['from-name'] = $name; return $this; } - public function addReplyTo($email) { - $this->guts['reply-to'] = $email; + public function addReplyTo($email, $name = '') { + if (empty($this->guts['reply-to'])) { + $this->guts['reply-to'] = array(); + } + $this->guts['reply-to'][] = array( + 'email' => $email, + 'name' => $name, + ); return $this; } diff --git a/src/applications/metamta/storage/mail/PhabricatorMetaMTAMail.php b/src/applications/metamta/storage/mail/PhabricatorMetaMTAMail.php index 089fff624e..6b0a747c14 100644 --- a/src/applications/metamta/storage/mail/PhabricatorMetaMTAMail.php +++ b/src/applications/metamta/storage/mail/PhabricatorMetaMTAMail.php @@ -213,23 +213,30 @@ class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO { $mailer->setFrom($default); } else if (!PhabricatorEnv::getEnvConfig('metamta.can-send-as-user')) { $from = $params['from']; + $handle = $handles[$from]; if (empty($params['reply-to'])) { - $params['reply-to'] = $handles[$from]->getEmail(); + $params['reply-to'] = $handle->getEmail(); + $params['reply-to-name'] = $handle->getFullName(); } - $mailer->setFrom($default); + $mailer->setFrom( + $default, + $handle->getFullName()); unset($params['from']); } $is_first = !empty($params['is-first-message']); unset($params['is-first-message']); + $reply_to_name = idx($params, 'reply-to-name', ''); + unset($params['reply-to-name']); + foreach ($params as $key => $value) { switch ($key) { case 'from': $mailer->setFrom($handles[$value]->getEmail()); break; case 'reply-to': - $mailer->addReplyTo($value); + $mailer->addReplyTo($value, $reply_to_name); break; case 'to': $emails = array();