From c8c61d017efa35b2390f3dadeeff1ce6f343f07f Mon Sep 17 00:00:00 2001 From: Dieter Funk Date: Thu, 7 May 2015 09:51:13 +0200 Subject: [PATCH 1/4] added new function to fetch raw headers from mail --- src/Fetch/Message.php | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Fetch/Message.php b/src/Fetch/Message.php index dbe9497..27eec83 100755 --- a/src/Fetch/Message.php +++ b/src/Fetch/Message.php @@ -43,6 +43,13 @@ class Message */ protected $imapStream; + /** + * This as an object which contains raw header information for the message. + * + * @var string + */ + protected $rawHeaders; + /** * This as an object which contains header information for the message. * @@ -291,7 +298,23 @@ class Message return $this->messageOverview; } - /** + /** + * This function returns an object containing the raw headers of the message. + * + * @param bool $forceReload + * @return string + */ + public function getRawHeaders($forceReload = false) + { + if ($forceReload || !isset($this->rawHeaders)) { + // raw headers (since imap_headerinfo doesn't use the unique id) + $this->rawHeaders = imap_fetchheader($this->imapStream, $this->uid, FT_UID); + } + + return $this->rawHeaders; + } + + /** * 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. @@ -303,7 +326,7 @@ class Message { if ($forceReload || !isset($this->headers)) { // raw headers (since imap_headerinfo doesn't use the unique id) - $rawHeaders = imap_fetchheader($this->imapStream, $this->uid, FT_UID); + $rawHeaders = $this->getRawHeaders(); // convert raw header string into a usable object $headerObject = imap_rfc822_parse_headers($rawHeaders); From 45b8a2d5e2ee784e6c56e68724b16eb7359c8e16 Mon Sep 17 00:00:00 2001 From: Dieter Funk Date: Tue, 12 May 2015 13:50:00 +0200 Subject: [PATCH 2/4] fixes --- src/Fetch/Message.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Fetch/Message.php b/src/Fetch/Message.php index 27eec83..dd52064 100755 --- a/src/Fetch/Message.php +++ b/src/Fetch/Message.php @@ -44,7 +44,7 @@ class Message protected $imapStream; /** - * This as an object which contains raw header information for the message. + * This as an string which contains raw header information for the message. * * @var string */ From 8d7a9c271b0b7827da82120800029637a1bc8542 Mon Sep 17 00:00:00 2001 From: Dieter Funk Date: Tue, 12 May 2015 13:53:59 +0200 Subject: [PATCH 3/4] use space instead of tabs as indentation --- src/Fetch/Message.php | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Fetch/Message.php b/src/Fetch/Message.php index dd52064..dfedb8c 100755 --- a/src/Fetch/Message.php +++ b/src/Fetch/Message.php @@ -43,12 +43,12 @@ class Message */ protected $imapStream; - /** - * This as an string which contains raw header information for the message. - * - * @var string - */ - protected $rawHeaders; + /** + * This as an string which contains raw header information for the message. + * + * @var string + */ + protected $rawHeaders; /** * This as an object which contains header information for the message. @@ -298,23 +298,23 @@ class Message return $this->messageOverview; } - /** - * This function returns an object containing the raw headers of the message. - * - * @param bool $forceReload - * @return string - */ - public function getRawHeaders($forceReload = false) - { - if ($forceReload || !isset($this->rawHeaders)) { - // raw headers (since imap_headerinfo doesn't use the unique id) - $this->rawHeaders = imap_fetchheader($this->imapStream, $this->uid, FT_UID); - } + /** + * This function returns an object containing the raw headers of the message. + * + * @param bool $forceReload + * @return string + */ + public function getRawHeaders($forceReload = false) + { + if ($forceReload || !isset($this->rawHeaders)) { + // raw headers (since imap_headerinfo doesn't use the unique id) + $this->rawHeaders = imap_fetchheader($this->imapStream, $this->uid, FT_UID); + } - return $this->rawHeaders; - } + return $this->rawHeaders; + } - /** + /** * 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. From 5f3a078ac5cc1bcdd9e973fdb5879470479800b7 Mon Sep 17 00:00:00 2001 From: Dieter Funk Date: Tue, 12 May 2015 15:47:32 +0200 Subject: [PATCH 4/4] psr fix --- src/Fetch/Message.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Fetch/Message.php b/src/Fetch/Message.php index dfedb8c..1bd9618 100755 --- a/src/Fetch/Message.php +++ b/src/Fetch/Message.php @@ -301,7 +301,7 @@ class Message /** * This function returns an object containing the raw headers of the message. * - * @param bool $forceReload + * @param bool $forceReload * @return string */ public function getRawHeaders($forceReload = false)