From 157547a51fd9a77ba929fca4631a3f52b124cb5a Mon Sep 17 00:00:00 2001 From: gergoe Date: Fri, 21 Nov 2014 13:47:30 +0100 Subject: [PATCH 1/2] Fixing an issue with embedded images Fixed the issue with html parsing when there was an embedded base64 encoded image in the source - which resulted in regexp errors (too long regexp). --- class.phpmailer.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/class.phpmailer.php b/class.phpmailer.php index 8d6c291fe..4ebb31a64 100644 --- a/class.phpmailer.php +++ b/class.phpmailer.php @@ -2910,11 +2910,7 @@ public function msgHTML($message, $basedir = '', $advanced = false) } $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2 if ($this->addStringEmbeddedImage($data, $cid, '', 'base64', $match[1])) { - $message = preg_replace( - '/' . $images[1][$imgindex] . '=["\']' . preg_quote($url, '/') . '["\']/Ui', - $images[1][$imgindex] . '="cid:' . $cid . '"', - $message - ); + $message = str_replace($images[0][$imgindex], $images[1][$imgindex] . '="cid:' . $cid . '"', $message); } } elseif (!preg_match('#^[A-z]+://#', $url)) { // Do not change urls for absolute images (thanks to corvuscorax) From 76a67bc1a0be00e5df9c39779e2904581c733d03 Mon Sep 17 00:00:00 2001 From: gergoe Date: Fri, 21 Nov 2014 14:02:42 +0100 Subject: [PATCH 2/2] changed white spaces --- class.phpmailer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class.phpmailer.php b/class.phpmailer.php index 4ebb31a64..9220895b7 100644 --- a/class.phpmailer.php +++ b/class.phpmailer.php @@ -2910,7 +2910,7 @@ public function msgHTML($message, $basedir = '', $advanced = false) } $cid = md5($url) . '@phpmailer.0'; // RFC2392 S 2 if ($this->addStringEmbeddedImage($data, $cid, '', 'base64', $match[1])) { - $message = str_replace($images[0][$imgindex], $images[1][$imgindex] . '="cid:' . $cid . '"', $message); + $message = str_replace($images[0][$imgindex], $images[1][$imgindex] . '="cid:' . $cid . '"', $message); } } elseif (!preg_match('#^[A-z]+://#', $url)) { // Do not change urls for absolute images (thanks to corvuscorax)