Skip to content
This repository was archived by the owner on May 25, 2023. It is now read-only.

Commit ee66dc4

Browse files
authored
Merge pull request #2 from covobo/feature/mime-decoder-iconv
Support iconv mime decoder
2 parents d258e65 + 5cb80df commit ee66dc4

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
"ericmartel/codeception-email": "^1.0",
2424
"friendsofphp/php-cs-fixer": "^2.15.0"
2525
},
26+
"suggest": {
27+
"ext-iconv": "Will be used as a mime decoder (iconv_mime_decode)",
28+
"ext-mbstring": "Will be used as a mime decoder if ext-iconv is not installed (mb_decode_mimeheader)"
29+
},
2630
"autoload": {
2731
"psr-4": {
2832
"Codeception\\Module\\": "src"

src/MailHog.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,12 @@ protected function getDecodedEmailProperty($email, $property): string
459459
) {
460460
$property = quoted_printable_decode($property);
461461
}
462-
if (stripos($property, '=?utf-8?Q?') !== false && extension_loaded('mbstring')) {
463-
$property = mb_decode_mimeheader($property);
462+
if (stripos($property, '=?utf-8?Q?') !== false) {
463+
if (extension_loaded('iconv')) {
464+
$property = iconv_mime_decode($property);
465+
} elseif (extension_loaded('mbstring')) {
466+
$property = mb_decode_mimeheader($property);
467+
}
464468
}
465469
}
466470

0 commit comments

Comments
 (0)