Send messages with only a CC

Summary: This keeps people in the correct To or CC field on multiplexed messages.

Test Plan:
with multiplexing on, checked that I received an email with me in the CC
field instead of the To field for a diff I'm CC'd on.

Reviewers: epriestley, jungejason, vrana

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D2999
This commit is contained in:
Nick Harper
2012-07-17 16:50:52 -07:00
parent b039bcaacc
commit 67c302ae4f
3 changed files with 27 additions and 8 deletions

View File

@@ -142,9 +142,16 @@ abstract class PhabricatorMailReplyHandler {
$body .= "\n";
$body .= $this->getRecipientsSummary($to_handles, $cc_handles);
foreach ($recipients as $recipient) {
foreach ($recipients as $phid => $recipient) {
$mail = clone $mail_template;
$mail->addTos(array($recipient->getPHID()));
if (isset($to_handles[$phid])) {
$mail->addTos(array($phid));
} else if (isset($cc_handles[$phid])) {
$mail->addCCs(array($phid));
} else {
// not good - they should be a to or a cc
continue;
}
$mail->setBody($body);

View File

@@ -606,16 +606,22 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
}
$empty_to =
PhabricatorEnv::getEnvConfig('metamta.placeholder-to-recipient');
if ($empty_to !== null && !$add_to) {
$mailer->addTos(array($empty_to));
}
if ($add_to) {
$mailer->addTos($add_to);
if ($add_cc) {
}
if ($add_cc) {
if ($empty_to !== null) {
$mailer->addCCs($add_cc);
} else {
$mailer->addTos($add_cc);
}
} else if ($add_cc) {
// If we have CC addresses but no "to" address, promote the CCs to
// "to".
$mailer->addTos($add_cc);
} else {
}
if (!$add_to && !$add_cc) {
$this->setStatus(self::STATUS_VOID);
$this->setMessage(
"Message has no valid recipients: all To/CC are disabled or ".