diff --git a/composer.json b/composer.json index 67b1151..7193129 100644 --- a/composer.json +++ b/composer.json @@ -23,6 +23,10 @@ "ericmartel/codeception-email": "^1.0", "friendsofphp/php-cs-fixer": "^2.15.0" }, + "suggest": { + "ext-iconv": "Will be used as a mime decoder (iconv_mime_decode)", + "ext-mbstring": "Will be used as a mime decoder if ext-iconv is not installed (mb_decode_mimeheader)" + }, "autoload": { "psr-4": { "Codeception\\Module\\": "src" diff --git a/src/MailHog.php b/src/MailHog.php index 76788be..b6e105d 100644 --- a/src/MailHog.php +++ b/src/MailHog.php @@ -459,8 +459,12 @@ protected function getDecodedEmailProperty($email, $property): string ) { $property = quoted_printable_decode($property); } - if (stripos($property, '=?utf-8?Q?') !== false && extension_loaded('mbstring')) { - $property = mb_decode_mimeheader($property); + if (stripos($property, '=?utf-8?Q?') !== false) { + if (extension_loaded('iconv')) { + $property = iconv_mime_decode($property); + } elseif (extension_loaded('mbstring')) { + $property = mb_decode_mimeheader($property); + } } }