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

Commit

Permalink
Merge pull request #2 from covobo/feature/mime-decoder-iconv
Browse files Browse the repository at this point in the history
Support iconv mime decoder
  • Loading branch information
covobo authored Jul 20, 2020
2 parents d258e65 + 5cb80df commit ee66dc4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 6 additions & 2 deletions src/MailHog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit ee66dc4

Please sign in to comment.