1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

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

@ -266,6 +266,12 @@ return array(
// sometimes referred to as "multiplexing".
'metamta.one-mail-per-recipient' => true,
// When sending a message that has no To recipient (i.e. all recipients
// are CC'd, for example when multiplexing mail), set the To field to the
// following value. If no value is set, messages with no To will have
// their CCs upgraded to To.
'metamta.placeholder-to-recipient' => null,
// When a user takes an action which generates an email notification (like
// commenting on a Differential revision), Phabricator can either send that
// mail "From" the user's email address (like "alincoln@logcabin.com") or

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 ".