예제 #1
0
 /**
  * Returns the message IDs of all emails this message references.
  *
  * @access  public
  * @param   string $text_headers The full headers of the message
  * @return  array An array of message-ids
  */
 function getAllReferences($text_headers)
 {
     $references = array();
     if (preg_match('/^In-Reply-To: (.*)/mi', $text_headers, $matches)) {
         $references[] = trim($matches[1]);
     }
     if (preg_match('/^References: (.+?)(\\r?\\n\\r?\\n|\\r?\\n\\r?\\S)/smi', $text_headers, $matches)) {
         $references = array_merge($references, explode(" ", Mail_API::unfold(trim($matches[1]))));
         $references = array_map('trim', $references);
         $references = array_unique($references);
     }
     foreach ($references as $key => $reference) {
         if (empty($reference)) {
             unset($references[$key]);
         }
     }
     return $references;
 }
예제 #2
0
 /**
  * Splits the full email into headers and body
  * 
  * @access  public
  * @param   string $message The full email message
  * @param   boolean $unfold If headers should be unfolded
  * @return  array An array containing the headers and body
  */
 function splitHeaderBody($message, $unfold = true)
 {
     if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s", $message, $match)) {
         return array($unfold ? Mail_API::unfold($match[1]) : $match[1], $match[2]);
     }
     return array();
 }