From a76c512a1eb0dfcc30e6ff5e92d5e40d6f261bea Mon Sep 17 00:00:00 2001 From: FreeScout Date: Fri, 17 Mar 2023 07:21:49 -0700 Subject: [PATCH] Fix empty body issue when fetching emails via Webklex/php-imap library - closes #1972 --- overrides/webklex/php-imap/src/Message.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/overrides/webklex/php-imap/src/Message.php b/overrides/webklex/php-imap/src/Message.php index 35062266..e4b68073 100644 --- a/overrides/webklex/php-imap/src/Message.php +++ b/overrides/webklex/php-imap/src/Message.php @@ -724,7 +724,11 @@ class Message { } if (function_exists('iconv') && $from != 'UTF-7' && $to != 'UTF-7') { - return @iconv($from, $to.'//IGNORE', $str); + try { + return iconv($from, $to.'//IGNORE', $str); + } catch (\Exception $e) { + return @iconv($from, $to, $str); + } } else { if (!$from) { return mb_convert_encoding($str, $to);