Beispiel #1
0
 /**
  * Returns an array of headers that will be sent with this message
  *
  * @param \r8\Mail $mail The piece of mail whose headers should be returned
  * @return Array The key is the header name, the value is the value of
  *      the header
  */
 public function getHeaderList(\r8\Mail $mail)
 {
     $result = array();
     if ($mail->fromExists()) {
         $result['From'] = self::formatAddress($mail->getFrom(), $mail->getFromName());
     }
     if ($mail->hasTos()) {
         $result['To'] = $this->getToString($mail);
     }
     if ($mail->hasCCs()) {
         $result['CC'] = $this->getCCString($mail);
     }
     if ($mail->hasBCCs()) {
         $result['BCC'] = $this->getBCCString($mail);
     }
     if ($mail->subjectExists()) {
         $result['Subject'] = $mail->getSubject();
     }
     $result['Date'] = date('r');
     $result["MIME-Version"] = "1.0";
     if ($mail->messageIDExists()) {
         $result['Message-ID'] = '<' . $mail->getMessageID() . '>';
     }
     if ($mail->htmlExists() && $mail->textExists()) {
         $result['Content-Type'] = "multipart/alternative;\nboundary='" . $mail->getBoundary() . "'";
     } else {
         if ($mail->htmlExists()) {
             $result['Content-Type'] = 'text/html; charset="ISO-8859-1"';
             $result["Content-Transfer-Encoding"] = "7bit";
         } else {
             $result['Content-Type'] = 'text/plain; charset="ISO-8859-1"';
             $result["Content-Transfer-Encoding"] = "7bit";
         }
     }
     return $result;
 }