Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html body #36

Closed
fadedshadowx opened this issue Oct 27, 2020 · 4 comments
Closed

html body #36

fadedshadowx opened this issue Oct 27, 2020 · 4 comments
Labels
bug Something isn't working validated

Comments

@fadedshadowx
Copy link

I am trying to parse test email and have one with html body. In email client it's ok html mail, but your parser doesn't recognize properly. It's doesn't show sender too.

Message full headers:

Return-Path: <0100017554afae0e-65c7b097-c632-4a81-aba0-0983b1300228-000000@amazonses.com>
Delivered-To: receipent@email
Received: from server.email.com
    by server.email.com with LMTP
    id N8kKEpybkl/lgCwA87l24w
    (envelope-from <0100017554afae0e-65c7b097-c632-4a81-aba0-0983b1300228-000000@amazonses.com>)
    for <receipent@email>; Fri, 23 Oct 2020 11:00:12 +0200
Return-path: <0100017554afae0e-65c7b097-c632-4a81-aba0-0983b1300228-000000@amazonses.com>
Envelope-to: receipent@email
Delivery-date: Fri, 23 Oct 2020 11:00:12 +0200
Received: from a48-34.smtp-out.amazonses.com ([54.240.48.34])
    by server.email.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
    (Exim 4.94)
    (envelope-from <0100017554afae0e-65c7b097-c632-4a81-aba0-0983b1300228-000000@amazonses.com>)
    id 1kVsvf-00CEyu-Jm
    for receipent@email; Fri, 23 Oct 2020 11:00:12 +0200
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple;
    s=jbdfwjcez6foes243en2m7xftncokldr; d=pilotmail.io; t=1603443601;
    h=Date:From:Reply-To:To:Message-ID:Subject:Mime-Version:Content-Type:Content-Transfer-Encoding;
    bh=x5tlIUXRbj7s1gxM3CNFra8jx/CX0HpLJDpRlSt2584=;
    b=QJDnIunskiGFk2HabG5hR5Ad5VPrDFsLPOSbewBxkvOjpK/iheV6hVd/a1YjAqdh
    ihcHknBI59tRcUySH5uQ+a6FJduPDItYkLrGC9BjNmEcaiU+txUUHrPDPTsPIKPcnOA
    DCZitXXwHrs2vr1f6qDBZdfvtLChNlWbhG0Y6oB4=
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple;
    s=224i4yxa5dv7c2xz3womw6peuasteono; d=amazonses.com; t=1603443601;
    h=Date:From:Reply-To:To:Message-ID:Subject:Mime-Version:Content-Type:Content-Transfer-Encoding:Feedback-ID;
    bh=x5tlIUXRbj7s1gxM3CNFra8jx/CX0HpLJDpRlSt2584=;
    b=PEy9ba+2EBskelpszrzak2ZzKT4okwnDdSMvbkyGsD/E4WCzlwCBc2g7wswGuZ1y
    YBm3WRo7e/boW43EMxF9FGOS+i0oZJS7Vx64n2WhApMLOAaIvjpQnGIBSdJPwXxWVh8
    3LTm/SyxpnhWcxqsXK5q2ZDmPWNrh3UB6zy9eLPg=
Date: Fri, 23 Oct 2020 09:00:00 +0000
From: Damian  <test@pilotmail.io> (Pilotmail)
Reply-To: Damian  <my_email@gmail.com>
To: receipent@email
Message-ID: <0100017554afae0e-65c7b097-c632-4a81-aba0-0983b1300228-000000@email.amazonses.com>
Mime-Version: 1.0
Content-Type: multipart/alternative;
    boundary="--==_mimepart_5f929b8fb3e42_65132ab76a9181b4105281";
    charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SES-Outgoing: 2020.10.23-54.240.48.34
Feedback-ID: 1.us-east-1.62FKEKNPNNwvQjVIWf53fKHL0TdoZybuoN5ycZbAYdw=:AmazonSES
Forward-Confirmed-ReverseDNS: Reverse and forward lookup success on 54.240.48.34, -10 Spam score
SPFCheck: Server passes SPF test, -30 Spam score
X-DKIM: signer='pilotmail.io' status='pass' reason=''
DKIMCheck: Server passes DKIM test, -20 Spam score
X-DKIM: signer='amazonses.com' status='pass' reason=''
X-Spam-Score: 5.6 (+++++)
X-Spam-Report: ----------------- AUTOMATYCZNY raport antySPAMowy ----------------------
    Oprogramowanie do wykrywania spamu, dziaajce na serwerze:
    *** "server.email.com" ***,
    zidentyfikowao ten email jako prawdopodobny spam. Oryginalna wiadomo
    zostaa doczona do tej, aby mona byo j przejrze, zweryfikowa lub
    zablokowa na przyszo. Jeeli masz jakie wtpliwoci, to kieruj je pod
    adres the administrator of that system
    Przegld zawartoci: Simple Transactional Email This is preheader text. Some clients
    will show this text as a preview. Hello client, 
    Szczegy analizy zawartoci: (5.6 zaliczonych, 5.0 wymaganych)
    pkt nazwa reguy krtki opis
    ---- ---------------------- -------------------------------------------
    -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2)
    [54.240.48.34 listed in wl.mailspike.net]
    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_NONE SPF: HELO does not publish an SPF Record
    0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was
    blocked. See
    http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
    for more information.
    [URIs: pilotmail.io]
    0.0 T_KAM_HTML_FONT_INVALID BODY: Test for Invalidly Named or
    Formatted Colors in HTML
    0.1 MIME_HTML_MOSTLY BODY: Wiadomo wieloczciowa, gownie
    tekst/html MIME
    0.0 HTML_MESSAGE BODY: Wiadomo zawiera kod HTML
    0.7 MPART_ALT_DIFF BODY: HTML and text parts are different
    -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
    author's domain
    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.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from
    envelope-from domain
    2.2 HTML_TITLE_SUBJ_DIFF No description available.
    2.5 FREEMAIL_FORGED_REPLYTO Freemail in Reply-To, but not From
X-Old-Subject:test
Subject: *****SPAM***** test
X-Spam-Status: Yes, score=5.6, +20 total spam score
SpamTally: Final spam score: -4

hasHTMLBody is empty, only getTextBody working..

$message->getBodies() value:

array:1 [▼
  "text" => """
    ----==_mimepart_5f929b8fb3e42_65132ab76a9181b4105281


    Content-Type: text/html;


     charset=UTF-8


    Content-Transfer-Encoding: quoted-printable


    


    <!DOCTYPE html>=0D


    <html>=0D


      <head>=0D


        <meta name=3D"viewport" content=3D"width=3Ddevice-width">=0D


        <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF=


    -8">=0D


        <title>Simple Transactional Email</title>=0D


        =0D


      <style>@media only screen and (max-width: 620px) {=0D


      table[class=3Dbody] h1 {=0D


        font-size: 28px !important; margin-bottom: 10px !important;=0D


      }=0D


      table[class=3Dbody] p {=0D


        font-size: 16px !important;=0D


      }=0D


      table[class=3Dbody] ul {=0D


        font-size: 16px !important;=0D


      }=0D


      table[class=3Dbody] ol {=0D


        font-size: 16px !important;=0D


      }=0D


      table[class=3Dbody] td {=0D


        font-size: 16px !important;=0D


      }=0D


      table[class=3Dbody] span {=0D


        font-size: 16px !important;=0D


      }=0D


      table[class=3Dbody] a {=0D


        font-size: 16px !important;=0D


      }=0D


      table[class=3Dbody] .wrapper {=0D


        padding: 10px !important;=0D


      }=0D


      table[class=3Dbody] .article {=0D


        padding: 10px !important;=0D


      }=0D


      table[class=3Dbody] .content {=0D


        padding: 0 !important;=0D


      }=0D


      table[class=3Dbody] .container {=0D


        padding: 0 !important; width: 100% !important;=0D


      }=0D


      table[class=3Dbody] .main {=0D


        border-left-width: 0 !important; border-radius: 0 !important; border-=


    right-width: 0 !important;=0D


      }=0D


      table[class=3Dbody] .btn table {=0D


        width: 100% !important;=0D


      }=0D


      table[class=3Dbody] .btn a {=0D


        width: 100% !important;=0D


      }=0D


      table[class=3Dbody] .img-responsive {=0D


        height: auto !important; max-width: 100% !important; width: auto !imp=


    ortant;=0D


      }=0D


    }=0D


    .ExternalClass {=0D


    width: 100%;=0D


    }=0D


    .ExternalClass {=0D


    line-height: 100%;=0D


    }=0D


    .btn-primary table td:hover {=0D


    background-color: #34495e !important;=0D


    }=0D


    .btn-primary a:hover {=0D


    background-color: #34495e !important; border-color: #34495e !important;=0D=


    


    }=0D


    </style>=0D


    </head>=0D


      <body class=3D"" style=3D"font-family: sans-serif; -webkit-font-smoothi=


    ng: antialiased; font-size: 14px; line-height: 1.4; -ms-text-size-adjust:=


     100%; -webkit-text-size-adjust: 100%; margin: 0; padding: 0;" bgcolor=3D=


    "#f6f6f6">=0D


        <span class=3D"preheader" style=3D"color: transparent; display: none;=


     height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; ms=


    o-hide: all; visibility: hidden; width: 0;">This is preheader text. Some =


    clients will show this text as a preview.</span>=0D


        <table border=3D"0" cellpadding=3D"0" cellspacing=3D"0" class=3D"body=


    " style=3D"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rs=


    pace: 0pt; width: 100%;" bgcolor=3D"#f6f6f6">=0D


          <tr>=0D


            <td style=3D"font-family: sans-serif; font-size: 14px;" valign=3D=


    "top">=C2=A0</td>=0D


            <td class=3D"container" style=3D"font-family: sans-serif; font-si=


    ze: 14px; display: block; max-width: 580px; width: 580px; margin: 0 auto;=


     padding: 10px;" valign=3D"top">=0D


              <div class=3D"content" style=3D"box-sizing: border-box; display=


    : block; max-width: 580px; margin: 0 auto; padding: 10px;">=0D


    =0D


                <!-- START CENTERED WHITE CONTAINER -->=0D


                <table class=3D"main" style=3D"border-collapse: separate; mso=


    -table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; border-radius: 3p=


    x;" bgcolor=3D"#ffffff">=0D


    =0D


                  <!-- START MAIN CONTENT AREA -->=0D


                  <tr>=0D


                    <td class=3D"wrapper" style=3D"font-family: sans-serif; f=


    ont-size: 14px; box-sizing: border-box; padding: 20px;" valign=3D"top">=0D=


    


                      <table border=3D"0" cellpadding=3D"0" cellspacing=3D"0"=


     style=3D"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rsp=


    ace: 0pt; width: 100%;">=0D


                        <tr>=0D


                          <td style=3D"font-family: sans-serif; font-size: 14=


    px;" valign=3D"top">=0D


                            <p style=3D"font-family: sans-serif; font-size: 1=


    4px; font-weight: normal; margin: 0 0 15px;">Hello client,</p>=0D


                            <p style=3D"font-family: sans-serif; font-size: 1=


    4px; font-weight: normal; margin: 0 0 15px;">Your order ..=0D


                            \t</p>=0D


    <p style=3D"font-family: sans-serif; font-size: 14px; font-weight: normal=


    ; margin: 0 0 15px;">...</p>=0D


                            =0D


                            <table border=3D"0" cellpadding=3D"0" cellspacing=


    =3D"0" class=3D"btn btn-primary" style=3D"border-collapse: separate; mso-=


    table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; box-sizing: border=


    -box;">=0D


                              <tbody>=0D


                                <tr>=0D


                                  <td align=3D"left" style=3D"font-family: sa=


    ns-serif; font-size: 14px; padding-bottom: 15px;" valign=3D"top">=0D


                                    <table border=3D"0" cellpadding=3D"0" cel=


    lspacing=3D"0" style=3D"border-collapse: separate; mso-table-lspace: 0pt;=


     mso-table-rspace: 0pt; width: auto;">=0D


                                      <tbody>=0D


                                        <tr>=0D


                                          <td style=3D"font-family: sans-seri=


    f; font-size: 14px; border-radius: 5px;" align=3D"center" bgcolor=3D"#349=


    8db" valign=3D"top"> <a href=3D"/public/payment/do/" target=3D"_blank" st=


    yle=3D"display: inline-block; color: #ffffff; background-color: #3498db; =


    border-radius: 5px; box-sizing: border-box; cursor: pointer; text-decorat=


    ion: none; font-size: 14px; font-weight: bold; text-transform: capitalize=


    ; margin: 0; padding: 12px 25px; border: 1px solid #3498db;">Pay order</a=


    > </td>=0D


                                        </tr>=0D


                                      </tbody>=0D


                                    </table>=0D


                                  </td>=0D


                                </tr>=0D


                              </tbody>=0D


                            </table>=0D


                          </td>=0D


                        </tr>=0D


                      </table>=0D


                    </td>=0D


                  </tr>=0D


    =0D


                <!-- END MAIN CONTENT AREA -->=0D


                </table>=0D


    =0D


                <!-- START FOOTER -->=0D


                <div class=3D"footer" style=3D"clear: both; margin-top: 10px;=


     width: 100%;" align=3D"center">=0D


                  <table border=3D"0" cellpadding=3D"0" cellspacing=3D"0" sty=


    le=3D"border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace:=


     0pt; width: 100%;">=0D


                    <tr>=0D


                      <td class=3D"content-block" style=3D"font-family: sans-=


    serif; padding-bottom: 10px; padding-top: 10px; font-size: 12px; color: #=


    999999;" align=3D"center" valign=3D"top">=0D


                        <span class=3D"apple-link" style=3D"color: #999999; f=


    ont-size: 12px; text-align: center;"> company bla bla bla</span>=0D


                        <br> Don't like these emails? <a href=3D"https://my=


    url.pl" style=3D"text-decoration: underline; color: #999999; font-size: 1=


    2px; text-align: center;">Unsubscribe</a>.=0D


                      </td>=0D


                    </tr>=0D


                  </table>=0D


                </div>=0D


                <!-- END FOOTER -->=0D


    =0D


              <!-- END CENTERED WHITE CONTAINER -->=0D


              </div>=0D


            </td>=0D


            <td style=3D"font-family: sans-serif; font-size: 14px;" valign=3D=


    "top">=C2=A0</td>=0D


          </tr>=0D


        </table>=0D


      </body>=0D


    </html>=0D


    


    ----==_mimepart_5f929b8fb3e42_65132ab76a9181b4105281
    """
]

@Webklex
Copy link
Owner

Webklex commented Oct 27, 2020

Hi @Damian-G ,
thanks for your report. Please add some additional detail such as:

  • Used webklex/php-imap version
  • Used protocol
  • Code example / how do you interact with it?

Regarding the missing sender header: the header value is missing in the provided example header - therefor the sender can't be parsed. Try to use the from header instead?

Best regards,

@fadedshadowx
Copy link
Author

"webklex/php-imap": "^2.2",
php 7.4.11
debian 9.13

my code:

$client = ImapClient::account('default');
$client->setDefaultMessageMask(MessageMask::class);
$client->connect();
$folder = $client->getFolder('INBOX');
$messages = $folder->messages()->all()->get();
foreach($messages as $message){
dd($message->getBodies());
}

message in html doesn't contain html value

@Webklex
Copy link
Owner

Webklex commented Dec 11, 2020

Hi @Damian-G ,
thanks again for your report 👍

Please update your php-imap dependency to v2.2.5.

Best regards,

@Webklex Webklex closed this as completed Dec 11, 2020
@imaaronath
Copy link

Hi my php-imap dependency already 2.3 but there is unknown string at the end
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working validated
Projects
None yet
Development

No branches or pull requests

3 participants