diff --git a/app/Console/Commands/FetchEmails.php b/app/Console/Commands/FetchEmails.php index f170fd92..c401ae61 100644 --- a/app/Console/Commands/FetchEmails.php +++ b/app/Console/Commands/FetchEmails.php @@ -416,6 +416,11 @@ class FetchEmails extends Command $subject = $message->getSubject(); + // Convert subject encoding + if (preg_match('/=\?[a-z\d-]+\?[BQ]\?.*\?=/i', $subject)) { + $subject = iconv_mime_decode($subject, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8'); + } + $to = $this->formatEmailList($message->getTo()); //$to = $mailbox->removeMailboxEmailsFromList($to);