Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/replyhandler/PhabricatorMailTarget.php
| Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | final class PhabricatorMailTarget extends Phobject { | ||||
| public function getViewer() { | public function getViewer() { | ||||
| return $this->viewer; | return $this->viewer; | ||||
| } | } | ||||
| public function willSendMail(PhabricatorMetaMTAMail $mail) { | public function willSendMail(PhabricatorMetaMTAMail $mail) { | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $show_stamps = $mail->shouldRenderMailStampsInBody($viewer); | |||||
| $body = $mail->getBody(); | |||||
| $html_body = $mail->getHTMLBody(); | |||||
| $has_html = (strlen($html_body) > 0); | |||||
| if ($show_stamps) { | |||||
| $stamps = $mail->getMailStamps(); | |||||
| $body .= "\n"; | |||||
| $body .= pht('STAMPS'); | |||||
| $body .= "\n"; | |||||
| $body .= implode(', ', $stamps); | |||||
| $body .= "\n"; | |||||
| if ($has_html) { | |||||
| $html = array(); | |||||
| $html[] = phutil_tag('strong', array(), pht('STAMPS')); | |||||
| $html[] = phutil_tag('br'); | |||||
| $html[] = phutil_implode_html(', ', $stamps); | |||||
| $html[] = phutil_tag('br'); | |||||
| $html = phutil_tag('div', array(), $html); | |||||
| $html_body .= hsprintf('%s', $html); | |||||
| } | |||||
| } | |||||
| $mail->addPHIDHeaders('X-Phabricator-To', $this->rawToPHIDs); | $mail->addPHIDHeaders('X-Phabricator-To', $this->rawToPHIDs); | ||||
| $mail->addPHIDHeaders('X-Phabricator-Cc', $this->rawCCPHIDs); | $mail->addPHIDHeaders('X-Phabricator-Cc', $this->rawCCPHIDs); | ||||
| $to_handles = $viewer->loadHandles($this->rawToPHIDs); | $to_handles = $viewer->loadHandles($this->rawToPHIDs); | ||||
| $cc_handles = $viewer->loadHandles($this->rawCCPHIDs); | $cc_handles = $viewer->loadHandles($this->rawCCPHIDs); | ||||
| $body = $mail->getBody(); | |||||
| $body .= "\n"; | $body .= "\n"; | ||||
| $body .= $this->getRecipientsSummary($to_handles, $cc_handles); | $body .= $this->getRecipientsSummary($to_handles, $cc_handles); | ||||
| $mail->setBody($body); | |||||
| $html_body = $mail->getHTMLBody(); | if ($has_html) { | ||||
| if (strlen($html_body)) { | |||||
| $html_body .= hsprintf( | $html_body .= hsprintf( | ||||
| '%s', | '%s', | ||||
| $this->getRecipientsSummaryHTML($to_handles, $cc_handles)); | $this->getRecipientsSummaryHTML($to_handles, $cc_handles)); | ||||
| } | } | ||||
| $mail->setBody($body); | |||||
| $mail->setHTMLBody($html_body); | $mail->setHTMLBody($html_body); | ||||
| $reply_to = $this->getReplyTo(); | $reply_to = $this->getReplyTo(); | ||||
| if ($reply_to) { | if ($reply_to) { | ||||
| $mail->setReplyTo($reply_to); | $mail->setReplyTo($reply_to); | ||||
| } | } | ||||
| $to = array_keys($this->getToMap()); | $to = array_keys($this->getToMap()); | ||||
| ▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines | |||||