From 066128c3685e5aa1cddd9e944baab263cb87eeef Mon Sep 17 00:00:00 2001 From: smartilabs Date: Sun, 29 Nov 2020 10:52:54 +0100 Subject: [PATCH 1/4] update getBoundary - allow ending with space or ; --- src/Structure.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Structure.php b/src/Structure.php index 1b12b80c..c4875d17 100644 --- a/src/Structure.php +++ b/src/Structure.php @@ -100,7 +100,7 @@ public function findContentType(){ * Determine the message content type */ public function getBoundary(){ - $boundary = $this->header->find("/boundary\=\"?(.*)\"?/"); + $boundary = $this->header->find("/boundary\=\"?(.*?)[\";\s]/"); return str_replace('"', '', $boundary); } From 926e6a577fb59f1efcc3452b7c2ccff1b307d8c8 Mon Sep 17 00:00:00 2001 From: smartilabs Date: Sun, 29 Nov 2020 10:54:15 +0100 Subject: [PATCH 2/4] Remove "inline" as valid attachment type --- src/Part.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Part.php b/src/Part.php index d67c6850..f4356304 100644 --- a/src/Part.php +++ b/src/Part.php @@ -299,7 +299,7 @@ private function parseEncoding(){ * @return bool */ public function isAttachment(){ - if ($this->type == IMAP::MESSAGE_TYPE_TEXT && ($this->ifdisposition == 0 || (empty($this->disposition) || !in_array(strtolower($this->disposition), ['attachment', 'inline'])) ) ) { + if ($this->type == IMAP::MESSAGE_TYPE_TEXT && ($this->ifdisposition == 0 || (empty($this->disposition) || !in_array(strtolower($this->disposition), ['attachment'])) ) ) { if (($this->subtype == null || in_array((strtolower($this->subtype)), ["plain", "csv", "html"])) && $this->filename == null && $this->name == null) { return false; } From eca4e150d0cc751c83c700d23cb5591719036e9a Mon Sep 17 00:00:00 2001 From: smartilabs Date: Sun, 29 Nov 2020 10:57:46 +0100 Subject: [PATCH 3/4] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 311a347e..565735cb 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "webklex/php-imap", + "name": "smartilabs/php-imap", "type": "library", "description": "PHP IMAP client", "keywords": [ From d1cb5e1dd543903b343fbdba6079f1557739e384 Mon Sep 17 00:00:00 2001 From: smartilabs Date: Sun, 13 Jun 2021 17:10:23 +0200 Subject: [PATCH 4/4] Allow for message_id and message-id Looks like imap_rfc822_parse_headers is returning different results depending on environment. --- src/Header.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Header.php b/src/Header.php index 8134ca3a..df1032cc 100644 --- a/src/Header.php +++ b/src/Header.php @@ -147,6 +147,8 @@ protected function parse(){ } if (property_exists($header, 'message_id')) { $this->attributes["message_id"] = str_replace(['<', '>'], '', $header->message_id); + } else if (property_exists($header, 'message-id')) { + $this->attributes["message_id"] = str_replace(['<', '>'], '', $header->{'message-id'}); } $this->parseDate($header);