コード例 #1
0
 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);
     $body = $mail->getBody();
     $body .= "\n";
     $body .= $this->getRecipientsSummary($to_handles, $cc_handles);
     $mail->setBody($body);
     $html_body = $mail->getHTMLBody();
     if (strlen($html_body)) {
         $html_body .= hsprintf('%s', $this->getRecipientsSummaryHTML($to_handles, $cc_handles));
     }
     $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;
 }