Example #1
0
 /**
  * This function returns an object containing the headers of the message. This is done by taking the raw headers
  * and running them through the imap_rfc822_parse_headers function. The results are only retrieved from the server
  * once unless passed true as a parameter.
  *
  * @param bool $force_reload Load headers anyway
  *
  * @return array
  */
 public function getHeaders($force_reload = false)
 {
     if ($force_reload || empty($this->headers)) {
         $raw_headers = $this->imap->fetchHeader($this->imap_stream, $this->uid, FT_UID);
         $decoded_headers = iconv_mime_decode_headers($raw_headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
         $this->headers = array_change_key_case($decoded_headers, CASE_LOWER);
     }
     return $this->headers;
 }