From c27593644c2f582049623c6f480a4d9b26112054 Mon Sep 17 00:00:00 2001 From: sergeypayu Date: Mon, 26 Oct 2015 18:07:26 +0200 Subject: [PATCH] Tiny fix for correct boundary parsing A better boundary detection that won't fail on such example: Content-Type: multipart/report; boundary="----=_Part_2509169_1730566862.1445846478023"; report-type=delivery-status --- PlancakeEmailParser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PlancakeEmailParser.php b/PlancakeEmailParser.php index 59e6cee..7958e04 100644 --- a/PlancakeEmailParser.php +++ b/PlancakeEmailParser.php @@ -203,7 +203,7 @@ public function getBody($returnType=self::PLAINTEXT) $contentTypeRegex = '/^Content-Type: ?text\/plain/i'; // there could be more than one boundary - preg_match_all('!boundary=(.*)$!mi', $this->emailRawContent, $matches); + preg_match_all('!boundary=(.*?)[;$]!mi', $this->emailRawContent, $matches); $boundaries = $matches[1]; // sometimes boundaries are delimited by quotes - we want to remove them foreach($boundaries as $i => $v) {