Exemplo n.º 1
0
 /**
  * Method used to build the headers of a web-based message.
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @param   string $message_id The message-id
  * @param   string $from The sender of this message
  * @param   string $to The primary recipient of this message
  * @param   string $cc The extra recipients of this message
  * @param   string $body The message body
  * @param   string $in_reply_to The message-id that we are replying to
  * @return  string The full email
  */
 function buildFullHeaders($issue_id, $message_id, $from, $to, $cc, $subject, $body, $in_reply_to)
 {
     // hack needed to get the full headers of this web-based email
     $mail = new Mail_API();
     $mail->setTextBody($body);
     if (!empty($issue_id)) {
         $mail->setHeaders(array("Message-Id" => $message_id));
     } else {
         $issue_id = 0;
     }
     // if there is no existing in-reply-to header, get the root message for the issue
     if ($in_reply_to == false && !empty($issue_id)) {
         $in_reply_to = Issue::getRootMessageID($issue_id);
     }
     if ($in_reply_to) {
         $mail->setHeaders(array("In-Reply-To" => $in_reply_to));
     }
     $cc = trim($cc);
     if (!empty($cc)) {
         $cc = str_replace(",", ";", $cc);
         $ccs = explode(";", $cc);
         for ($i = 0; $i < count($ccs); $i++) {
             if (!empty($ccs[$i])) {
                 $mail->addCc($ccs[$i]);
             }
         }
     }
     return $mail->getFullHeaders($from, $to, $subject);
 }