From c728e97165aeb11a054444bc2fa66c80970e2971 Mon Sep 17 00:00:00 2001 From: Alex Puiu Date: Fri, 11 Feb 2022 13:37:20 +0200 Subject: [PATCH] Improvements for encoded description. --- functions.php | 19 ------------------- index.php | 9 +++++++-- 2 files changed, 7 insertions(+), 21 deletions(-) delete mode 100644 functions.php diff --git a/functions.php b/functions.php deleted file mode 100644 index e09abcf..0000000 --- a/functions.php +++ /dev/null @@ -1,19 +0,0 @@ -= count($descarray) - 1) { - $data = base64_decode($data); - } - - return $data; -} - -?> \ No newline at end of file diff --git a/index.php b/index.php index 78aff60..e082245 100644 --- a/index.php +++ b/index.php @@ -1,7 +1,6 @@ getNewMessages(); if ($emails) for ($j = 0; $j < count($emails) && $j < 5; $j++) { $structure = $inbox->fetchMessageStructure($emails[$j]); + $base64encode = false; + if($structure->encoding == 3) { + $base64encode = true; // BASE64 + } $attachments = array(); $attNames = array(); if (isset($structure->parts) && count($structure->parts)) { @@ -76,7 +79,9 @@ if ($emails) } else { $description = DECODE_SPECIAL_CHARACTERS ? quoted_printable_decode($inbox->fetchMessageBody($emails[$j], 1)) : $inbox->fetchMessageBody($emails[$j], 1); } - $description = decodeIfNeeded($description); + if($base64encode) { + $description = base64_decode($description); + } $data->description = $description; $mailSender = new stdClass(); $mailSender->userId = $overview->from[0]->mailbox;