diff --git a/src/applications/metamta/replyhandler/PhabricatorMailTarget.php b/src/applications/metamta/replyhandler/PhabricatorMailTarget.php index c607087b2..37a201236 100644 --- a/src/applications/metamta/replyhandler/PhabricatorMailTarget.php +++ b/src/applications/metamta/replyhandler/PhabricatorMailTarget.php @@ -1,150 +1,180 @@ rawToPHIDs = $to_phids; return $this; } public function setRawCCPHIDs(array $cc_phids) { $this->rawCCPHIDs = $cc_phids; return $this; } public function setCCMap(array $cc_map) { $this->ccMap = $cc_map; return $this; } public function getCCMap() { return $this->ccMap; } public function setToMap(array $to_map) { $this->toMap = $to_map; return $this; } public function getToMap() { return $this->toMap; } public function setReplyTo($reply_to) { $this->replyTo = $reply_to; return $this; } public function getReplyTo() { return $this->replyTo; } public function setViewer($viewer) { $this->viewer = $viewer; return $this; } public function getViewer() { return $this->viewer; } public function willSendMail(PhabricatorMetaMTAMail $mail) { $viewer = $this->getViewer(); $mail->addPHIDHeaders('X-Phabricator-To', $this->rawToPHIDs); $mail->addPHIDHeaders('X-Phabricator-Cc', $this->rawCCPHIDs); $to_handles = $viewer->loadHandles($this->rawToPHIDs); $cc_handles = $viewer->loadHandles($this->rawCCPHIDs); + $note = "This is an automated email from the GnuPG development hub.\n"; + $note .= "You probably have registered in the past at https://bugs.gnupg.org/ and your\n"; + $note .= "account was migrated automatically. You can visit https://dev.gnupg.org/ to\n"; + $note .= "set a new password and update your email preferences. In case\n"; + $note .= "you have questions or technical difficulties, contact marcus@gnupg.org\n\n\n"; + + $html_note = array(); + $html_note[] = "This is an automated email from the GnuPG development hub.\n"; + $html_note[] = "You probably have registered in the past at "; + $html_note[] = phutil_tag("a", + array( + "href" => "https://bugs.gnupg.org/" + ), "https://bugs.gnupg.org/"); + $html_note[] = " and your\n"; + $html_note[] = "account was migrated automatically. You can visit "; + $html_note[] = phutil_tag("a", + array( + "href" => "https://dev.gnupg.org/" + ), "https://dev.gnupg.org/"); + $html_note[] = " to\n"; + $html_note[] = "set a new password and update your email preferences. In case\n"; + $html_note[] = "you have questions or technical difficulties, contact "; + $html_note[] = phutil_tag("a", + array( + "href" => "mailto:marcus@gnupg.org" + ), "marcus@gnupg.org"); + $html_note = phutil_tag("p", array(), $html_note); + $body = $mail->getBody(); $body .= "\n"; $body .= $this->getRecipientsSummary($to_handles, $cc_handles); + $body = $note . $body; $mail->setBody($body); $html_body = $mail->getHTMLBody(); if (strlen($html_body)) { $html_body .= hsprintf( '%s', $this->getRecipientsSummaryHTML($to_handles, $cc_handles)); } + $html_body = hsprintf('%s', $html_note) . $html_body; $mail->setHTMLBody($html_body); $reply_to = $this->getReplyTo(); if ($reply_to) { $mail->setReplyTo($reply_to); } $to = array_keys($this->getToMap()); if ($to) { $mail->addTos($to); } $cc = array_keys($this->getCCMap()); if ($cc) { $mail->addCCs($cc); } return $mail; } private function getRecipientsSummary( PhabricatorHandleList $to_handles, PhabricatorHandleList $cc_handles) { if (!PhabricatorEnv::getEnvConfig('metamta.recipients.show-hints')) { return ''; } $to_handles = iterator_to_array($to_handles); $cc_handles = iterator_to_array($cc_handles); $body = ''; if ($to_handles) { $to_names = mpull($to_handles, 'getCommandLineObjectName'); $body .= "To: ".implode(', ', $to_names)."\n"; } if ($cc_handles) { $cc_names = mpull($cc_handles, 'getCommandLineObjectName'); $body .= "Cc: ".implode(', ', $cc_names)."\n"; } return $body; } private function getRecipientsSummaryHTML( PhabricatorHandleList $to_handles, PhabricatorHandleList $cc_handles) { if (!PhabricatorEnv::getEnvConfig('metamta.recipients.show-hints')) { return ''; } $to_handles = iterator_to_array($to_handles); $cc_handles = iterator_to_array($cc_handles); $body = array(); if ($to_handles) { $body[] = phutil_tag('strong', array(), 'To: '); $body[] = phutil_implode_html(', ', mpull($to_handles, 'getName')); $body[] = phutil_tag('br'); } if ($cc_handles) { $body[] = phutil_tag('strong', array(), 'Cc: '); $body[] = phutil_implode_html(', ', mpull($cc_handles, 'getName')); $body[] = phutil_tag('br'); } return phutil_tag('div', array(), $body); } }