This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Mails with content-type: text/plain but HTML payload

Tags: None
(comma "," separated)
thomasfischer
Registered Member
Posts
11
Karma
0
Hello,

I receive emails from a sender who sends mails with a content-type of "text/plain" but the mails contain HTML code. This is obviously wrong as the mail's content type (to be precise, the MIME part) should be "text/html".
https://upload.disroot.org/r/dfZHYtAp#U ... TpGpi84v4=

KMail shows the raw HTML code, as it is, after all, "plain text". This is technically correct, which is the reason why I haven't opened a bug report for my problem, but it is not helpful, as it is rather cumbersome to read mails in raw HTML code. KMail does not allow to render the HTML code into something readable as it allows for "proper" HTML mails (i.e. those with content type "text/html").
https://upload.disroot.org/r/wre4L3Dt#x ... Xv9dOhzbI=

It is unlikely that the sender will change. Mails come from an automated system and direct bug reporting is not possible. All requests have to go through non-technical Windows users who fail to grasp the problem, as their mail client (Outlook, I assume) shows those mails "correctly".

As I want to read the mails after all, I am looking for a viable solution. I see two options:
1. Have some program/service rewrite in my inbox on my IMAP server (not self-hosted, no raw file system access possible) the mails' content type from "text/plain" to "text/html" if the payload starts with "<!doctype html>". Then, KMail will probably be able render those mails correctly. This program/service does not need to be a part of KMail or KDE, but could be a command line program a la isync/mbsync.
2. Let KMail be more fault tolerant: If a mail's payload states that it is of content type "text/plain" but obviously contains HTML code, then re-interpret the content type to "text/html" and continue from there. As opposed to option 1, this would not modify the mail, but would have to be done each time an email is to be rendered.

Any suggestions how to proceed? If you had similar problems, who did you fix it?

Thank you in advance!

Bye,
Thomas


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]