Skip to content

HTML message only shown as plain text #456

@bjaverhagen

Description

@bjaverhagen

Describe the bug
A HTML message only shown as plain text message. No HTML found but the message content shown HTML.
I've got this issue with multiple messages.
Please help?

Used config

$cm = new ClientManager($options = [ 'delimiter' => '.', 'fetch' => \Webklex\PHPIMAP\IMAP::FT_PEEK, 'sequence' => \Webklex\PHPIMAP\IMAP::ST_UID, 'fetch_body' => true, 'fetch_flags' => true, 'soft_fail' => false, 'rfc822' => true, 'debug' => false, 'uid_cache' => true, 'fallback_date' => "01.01.1970 00:00:00", 'boundary' => '/boundary=(.*?(?=;)|(.*))/i', 'message_key' => 'list', 'fetch_order' => 'desc', 'dispositions' => ['attachment', 'inline'], 'common_folders' => [	"root" => "INBOX",	"junk" => "INBOX.Junk",	"draft" => "INBOX.Drafts",	"sent" => "INBOX.Sent",	"trash" => "INBOX.Trash", ], 'decoder' => [	'message' => 'utf-8', // mimeheader	'attachment' => 'utf-8' // mimeheader ] ]); 

Code to Reproduce

if ( $message->hasHTMLBody() ) { echo $message->mask()->getHTMLBodyWithEmbeddedBase64Images(); if ( $message->hasTextBody() ) { if ( $spamreport ) { echo $message->getTextBody(); echo '<br><hr><br>'; echo $message->parseBody()->getStructure()->parts['2']->content; } else { echo nl2br($message->getTextBody()); } } else { echo $message->getRawBody(); } 

Expected behavior
Message shown as HTML message.

Screenshots
Message shown as follow (example):

image

Additional context
Message attributes:

Array ( [uid] => 2242 [msgn] => [msglist] => [from] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => from [values:protected] => Array ( [0] => Webklex\PHPIMAP\Address Object ( [personal] => XXXX [mailbox] => XXXX [host] => XXXX [mail] => XXXX [full] => XXXX ) ) ) [to] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => to [values:protected] => Array ( [0] => Webklex\PHPIMAP\Address Object ( [personal] => [mailbox] => XXXX [host] => XXXX [mail] => XXXX [full] => XXXX ) ) ) [reply_to] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => reply_to [values:protected] => Array ( [0] => Webklex\PHPIMAP\Address Object ( [personal] => XXXX [mailbox] => XXXX [host] => XXXX [mail] => XXXX [full] => XXXX ) ) ) [sender] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => sender [values:protected] => Array ( [0] => Webklex\PHPIMAP\Address Object ( [personal] => XXXX [mailbox] => XXXX [host] => XXXX [mail] => XXXX [full] => XXXX ) ) ) [subject] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => subject [values:protected] => Array ( [0] => De wintermaanden komen er weer aan. ) ) [message_id] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => message_id [values:protected] => Array ( [0] => 832811954.11953450.1700500227266@m2.mailplus.nl ) ) [date] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => date [values:protected] => Array ( [0] => Carbon\Carbon Object ( [endOfTime:protected] => [startOfTime:protected] => [constructedObjectId:protected] => 000000000000033a0000000000000000 [localMonthsOverflow:protected] => [localYearsOverflow:protected] => [localStrictModeEnabled:protected] => [localHumanDiffOptions:protected] => [localToStringFormat:protected] => [localSerializer:protected] => [localMacros:protected] => [localGenericMacros:protected] => [localFormatFunction:protected] => [localTranslator:protected] => [dumpProperties:protected] => Array ( [0] => date [1] => timezone_type [2] => timezone ) [dumpLocale:protected] => [dumpDateProperties:protected] => [date] => 2023-11-25 17:05:07.134886 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) ) ) [received] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => received [values:protected] => Array ( [0] => from mail by s202.webhostingserver.nl with spam-scanned (Exim 4.96.2) (envelope-from ) id 1r57n1-0087Ha-2J for XXXX; Mon, 20 Nov 2023 18:10:28 +0100 [1] => from smta24.spotler.email ([46.31.52.24]) by s202.webhostingserver.nl with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1r57n1-0087HK-21 for XXXX; Mon, 20 Nov 2023 18:10:27 +0100 [2] => by smta24.spotler.email id hbe9g633uogt for ; Mon, 20 Nov 2023 18:10:27 +0100 (envelope-from ) [3] => from s202.webhostingserver.nl by s202.webhostingserver.nl with LMTP id 0GqGGwSTW2XxLR0AqS+bIA (envelope-from ) for ; Mon, 20 Nov 2023 18:10:28 +0100 [4] => from mail by s202.webhostingserver.nl with spam-scanned (Exim 4.96.2) (envelope-from ) id 1r57n1-0087Ha-2J for XXXX ) ) [mime_version] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => mime_version [values:protected] => Array ( [0] => 1.0 ) ) [content_type] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => content_type [values:protected] => Array ( [0] => multipart/alternative; boundary="----=_NextPart_000_0002_01DA1BE4.45988D90" [1] => multipart/alternative ) ) [x_mailer] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => x_mailer [values:protected] => Array ( [0] => Microsoft Outlook 16.0 ) ) [authentication_results] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => authentication_results [values:protected] => Array ( [0] => webhostingserver.nl; iprev=pass (smta24.spotler.email) smtp.remote-ip=46.31.52.24; spf=pass smtp.mailfrom=bounces.mailplus.nl; dkim=pass header.d=spotler.email header.s=dkim-2018 header.a=rsa-sha256; dmarc=none header.from=multigift.nl; arc=none [1] => webhostingserver.nl ) ) [list_unsubscribe] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => list_unsubscribe [values:protected] => Array ( [0] => , ) ) [x_antivirus] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => x_antivirus [values:protected] => Array ( [0] => Avast (VPS 231116-12, 16-11-2023), Inbound message avast! (VPS 231116-12, 16-11-2023), Inbound message ) ) [x_antivirus_status] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => x_antivirus_status [values:protected] => Array ( [0] => Clean Clean ) ) [thread_index] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => thread_index [values:protected] => Array ( [0] => AQDS34xlbQ4renzxGdECnh4e+EXhLQ== ) ) [x_spam_checker_version] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => x_spam_checker_version [values:protected] => Array ( [0] => SpamAssassin 3.4.6 (2021-04-09) on s202.webhostingserver.nl ) ) [x_spam_level] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => x_spam_level [values:protected] => Array ( [0] => * ) ) [x_spam_status] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => x_spam_status [values:protected] => Array ( [0] => No, score=1.1 required=10.0 tests=ANTAGONIST_FCHECK1, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, HTML_FONT_LOW_CONTRAST,HTML_IMAGE_RATIO_08,HTML_MESSAGE, MIME_HTML_MOSTLY,MPART_ALT_DIFF,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 ) ) [x_spam_report] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => x_spam_report [values:protected] => Array ( [0] => * -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at * https://www.dnswl.org/, no trust * [46.31.52.24 listed in list.dnswl.org] * 0.0 ANTAGONIST_FCHECK1 Not antagonist.nl sender * 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level * mail domains are different * -0.0 SPF_PASS SPF: sender matches SPF record * -0.0 SPF_HELO_PASS SPF: HELO matches SPF record * 0.7 MPART_ALT_DIFF BODY: HTML and text parts are different * 0.0 HTML_FONT_LOW_CONTRAST BODY: HTML font color similar or * identical to background * 0.0 HTML_IMAGE_RATIO_08 BODY: HTML has a low ratio of text to image * area * 0.1 MIME_HTML_MOSTLY BODY: Multipart message mostly text/html MIME * 0.0 HTML_MESSAGE BODY: HTML included in message * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature * -0.0 T_SCC_BODY_TEXT_LINE No description available. ) ) [x_dkim] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => x_dkim [values:protected] => Array ( [0] => pass: (address=ret-uid=50157_a=551074_s=279945_d=FTMn5z@bounces.mailplus.nl domain=spotler.email), signature is good ) ) [x_report_abuse_to] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => x_report_abuse_to [values:protected] => Array ( [0] => abuse@spotler.email ) ) [x_antagonist_receiveuser] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => x_antagonist_receiveuser [values:protected] => Array ( [0] => XXXX ) ) [x_antivirus_scanner] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => x_antivirus_scanner [values:protected] => Array ( [0] => Clean mail though you should still use an Antivirus ) ) [x_olkeid] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => x_olkeid [values:protected] => Array ( [0] => 00000000315F91EF10BFF6489B8649FE8087B8B10700C3B68E10F77511CEB4CD00AA00BBB6E600000000000B000031732E44500CCA4FA18EAD17F21329A40000000006300000EB1D628F5C757B4196EAC595B09B3C80 ) ) [toaddress] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => toaddress [values:protected] => Array ( [0] => XXXX ) ) [fromaddress] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => fromaddress [values:protected] => Array ( [0] => XXXX ) ) [reply_toaddress] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => reply_toaddress [values:protected] => Array ( [0] => XXXX ) ) [senderaddress] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => senderaddress [values:protected] => Array ( [0] => XXXX ) ) [mon, 20 nov 2023 18:10:28 +0100, from smta24.spotler.email ([46.31.52.24]) by s202.webhostingserver.nl with esmtps (tls1.3) tls tls_aes_256_gcm_sha384 (exim 4.96.2) (envelope-from Webklex\PHPIMAP\Attribute Object ( [name:protected] => mon, 20 nov 2023 18:10:28 +0100, from smta24.spotler.email ([46.31.52.24]) by s202.webhostingserver.nl with esmtps (tls1.3) tls tls_aes_256_gcm_sha384 (exim 4.96.2) (envelope-from Array ( [0] => 50157_a=551074_s=279945_d=FTMn5z@bounces.mailplus.nl>) id 1r57n1-0087HK-21 for XXXX ) ) [mon, 20 nov 2023 18:10:27 +0100 (envelope-from Webklex\PHPIMAP\Attribute Object ( [name:protected] => mon, 20 nov 2023 18:10:27 +0100 (envelope-from Array ( [0] => 50157_a=551074_s=279945_d=FTMn5z@bounces.mailplus.nl>), from s202.webhostingserver.nl by s202.webhostingserver.nl with LMTP id 0GqGGwSTW2XxLR0AqS+bIA (envelope-from ) for ) ) [boundary] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => boundary [values:protected] => Array ( [0] => ----=_NextPart_000_0002_01DA1BE4.45988D90 ) ) [iprev] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => iprev [values:protected] => Array ( [0] => pass (smta24.spotler.email) smtp.remote-ip=46.31.52.24 ) ) [spf] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => spf [values:protected] => Array ( [0] => pass smtp.mailfrom=bounces.mailplus.nl ) ) [dkim] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => dkim [values:protected] => Array ( [0] => pass header.d=spotler.email header.s=dkim-2018 header.a=rsa-sha256 ) ) [dmarc] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => dmarc [values:protected] => Array ( [0] => none header.from=XXXX ) ) [arc] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => arc [values:protected] => Array ( [0] => none ) ) [priority] => Webklex\PHPIMAP\Attribute Object ( [name:protected] => priority [values:protected] => Array ( [0] => 0 ) ) ) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions