Bug 419949

Summary: KMail only partly shows HTML mail
Product: [Applications] kdepim Reporter: null <null>
Component: messageviewerAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: montel
Priority: NOR    
Version: GIT (master)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.14.0
Sentry Crash Report:
Attachments: Test Case
KMail 5.14.40 vs. Thunderbird 68.6.

Description null 2020-04-11 09:52:09 UTC
Created attachment 127445 [details]
Test Case

See attached test case: With HTML mode enabled, only the quote is visible, but not the actual reply.

While probably the sending MUA (GMX Mail for Android) is to blame for most of this, it would be great if KMail was able to deal with such mails (again).

I can reproduce this bug with KMail 5.9.2 (Qt 5.11.2 / KF 5.51) as well as KMail 5.14.40 (Qt 5.14.1 / KF 5.69).

Cross-Testing:
- Thunderbird is able to show everything just fine.
- Thunderbird correctly displays all line breaks, while KMail seems to strip every line break even in the quoted section.

It is interesting how rendering is getting worse over time:
- KMail 1.9.10 (Qt 3 w/ KHTML?) works excellent (with correct line breaks even).
- KMail 4.14.2 (Qt 4) renders the mail just fine (although without line breaks in the quoted part).
- KMail 5.9.2 (Qt 5 w/ QtWebKit?) displays some parts of the reply before KMail's mail header.
- KMail 5.14.40 (Qt 5 w/ QtWebEngine?) completely hides the reply.

Possibly related: Bug 345360

Bug 418482 also seem related, however the fix does not work in this case.
Comment 1 null 2020-04-11 09:52:52 UTC
Created attachment 127446 [details]
KMail 5.14.40 vs. Thunderbird 68.6.
Comment 2 Laurent Montel 2020-04-11 11:38:20 UTC
Did you see that your mailer created broken html ?
------C9ROYGRLREFJICWHYWEVHKB1AYEQAC
Content-Type: text/html;
 charset=utf-8
Content-Transfer-Encoding: 8bit

HTML REPLY<br>
SECOND LINE<br>
-- <br>
<html><head><meta http-equiv="Content-Type" content="text/plain; charset=utf-8" /></head><body  style="overflow-wrap:break-word; word-break: break-word;white-space:pre-wrap;"><div>You wrote:<blockquote style="margin: 0.8ex 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">HTML QUOTE

SECOND LINE
</blockquote></div></body></html>
------C9ROYGRLREFJICWHYWEVHKB1AYEQAC--

=> missing <html><body>
Comment 3 null 2020-04-11 11:43:29 UTC
I'm afraid I'm unable to convince that particular contact to switch to a more conforming mail app.

As for the missing "<html><body>", if you look closely, it is not actually missing, but only included in the last part (below "--").
Comment 4 Laurent Montel 2020-04-11 11:49:14 UTC
indeed very wierd as generated html code.
I will create a workaround for it.
Comment 5 Laurent Montel 2020-04-11 12:35:00 UTC
Git commit 4b945a37283acc010edc3d84a77c866f5a61cfee by Laurent Montel.
Committed on 11/04/2020 at 12:34.
Pushed by mlaurent into branch 'release/20.04'.

Fix Bug 419949 - KMail only partly shows HTML mail
FIXED-IN: 5.14.0

M  +9    -3    messageviewer/src/utils/autotests/messageviewerutilstest.cpp
M  +2    -4    messageviewer/src/utils/messageviewerutil.cpp

https://commits.kde.org/messagelib/4b945a37283acc010edc3d84a77c866f5a61cfee
Comment 6 null 2020-04-12 06:58:16 UTC
Thanks for fixing this so quickly, the reply shows up in KMail's latest git build now.

The only issue remaining is the missing line break in the quoted part (see screenshot above). I opened a new bug to track this: Bug 419978