mirror of https://github.com/itflow-org/itflow
Add Function to convert message text from UTF7 to UTF8 possibly fix the Google Issue not sure, we need further testing
This commit is contained in:
parent
fc82dc705e
commit
6bdfe1b713
|
|
@ -346,6 +346,11 @@ function getInboxFolder($client, $inboxNames) {
|
|||
throw new Exception("No inbox folder found.");
|
||||
}
|
||||
|
||||
// Function to convert UTF-7 IMAP to UTF-8
|
||||
function convertToUtf8($text) {
|
||||
return mb_convert_encoding($text, 'UTF-8', 'UTF7-IMAP');
|
||||
}
|
||||
|
||||
try {
|
||||
$inbox = getInboxFolder($client, $inboxNames);
|
||||
$messages = $inbox->query()->unseen()->get();
|
||||
|
|
@ -371,6 +376,11 @@ if ($messages->count() > 0) {
|
|||
|
||||
$subject = sanitizeInput($message->getSubject() ?? 'No Subject');
|
||||
$date = sanitizeInput($message->getDate() ?? date('Y-m-d H:i:s'));
|
||||
|
||||
// Convert message bodies from UTF-7 to UTF-8 if needed
|
||||
$html_body = convertToUtf8($message->getHtmlBody() ?? '');
|
||||
$text_body = convertToUtf8($message->getTextBody() ?? '');
|
||||
|
||||
$message_body = $message->getHtmlBody() ?? '';
|
||||
|
||||
if (empty($message_body)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue