1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 02:32:42 +01:00

Actually (???) fix mail multiplexing. I am awful at programming.

This commit is contained in:
epriestley 2012-04-16 10:35:52 -07:00
parent 1db0dadbcf
commit 283fee7c0a

View file

@ -108,18 +108,6 @@ abstract class PhabricatorMailReplyHandler {
$recipients = mpull($to_handles, null, 'getPHID') + $recipients = mpull($to_handles, null, 'getPHID') +
mpull($cc_handles, null, 'getPHID'); mpull($cc_handles, null, 'getPHID');
// This grouping is just so we can use the public reply-to for any
// recipients without a private reply-to, e.g. mailing lists.
$groups = array();
if ($this->supportsPrivateReplies) {
foreach ($recipients as $recipient) {
$private = $this->getPrivateReplyHandlerEmailAddress($recipient);
$groups[$private][] = $recipient;
}
} else {
$groups[''] = $recipients;
}
// When multiplexing mail, explicitly include To/Cc information in the // When multiplexing mail, explicitly include To/Cc information in the
// message body and headers. // message body and headers.
$add_headers = array(); $add_headers = array();
@ -135,15 +123,20 @@ abstract class PhabricatorMailReplyHandler {
$add_headers['X-Phabricator-Cc'] = $this->formatPHIDList($cc_handles); $add_headers['X-Phabricator-Cc'] = $this->formatPHIDList($cc_handles);
} }
foreach ($groups as $reply_to => $group) { foreach ($recipients as $recipient) {
$mail = clone $mail_template; $mail = clone $mail_template;
$mail->addTos(mpull($group, 'getPHID')); $mail->addTos(array($recipient->getPHID()));
$mail->setBody($body); $mail->setBody($body);
foreach ($add_headers as $header => $value) { foreach ($add_headers as $header => $value) {
$mail->addHeader($header, $value); $mail->addHeader($header, $value);
} }
$reply_to = null;
if (!$reply_to && $this->supportsPrivateReplies()) {
$reply_to = $this->getPrivateReplyHandlerEmailAddress($recipient);
}
if (!$reply_to && $this->supportsPublicReplies()) { if (!$reply_to && $this->supportsPublicReplies()) {
$reply_to = $this->getPublicReplyHandlerEmailAddress(); $reply_to = $this->getPublicReplyHandlerEmailAddress();
} }