thunderbird / thunderbird/thunderbird-android
Replying to a text/plain-only message generates unfavorable HTML
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 14k
- Forks
- 2.8k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 57
Description
Describe the bug
When replying to a message containing only a text/plain part and K-9 Mail is configured to send HTML messages, the app will generate HTML that puts the quoted text inside a <pre> tag. This leads to long lines not being wrapped in other clients. It works in K-9 Mail because we add the class k9mail to the tag and add a CSS rule for that class when displaying messages. However, this CSS style is not included in the message.
To Reproduce
Steps to reproduce the behavior:
- Receive a
text/plainmessage, e.g.Date: Sun, 22 Aug 2021 17:14:52 +0200 From: <alice@domain.example> To: <bob@domain.example> Subject: Long line, text/plain Message-ID: <msg001@domain.example> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable A line extremely extremely extremely extremely extremely extremely extremel= y extremely extremely extremely extremely extremely long long long long lon= g long long long long long long long long long long long long long long=2E - Make sure Settings > [Account] > Sending mail > Message format is set to HTML.
- Reply to the message from step 1
- The resulting message looks similar to this:
Date: Sun, 22 Aug 2021 17:16:03 +0200 From: Bob <bob@domain.example> To: <alice@domain.example> Subject: Re: Long line, text/plain User-Agent: K-9 Mail for Android In-Reply-To: <msg001@domain.example> References: <msg001@domain.example> Message-ID: <msg002@domain.example> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=----G7YE98IGHS1BNE3I2L90D9ODGHKSOP Content-Transfer-Encoding: 7bit ------G7YE98IGHS1BNE3I2L90D9ODGHKSOP Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable What is K-9 Mail doing with this when replying? On August 22, 2021 5:14:52 PM GMT+02:00, <alice@domain=2Eexample> wrote: >A line extremely extremely extremely extremely extremely extremely extrem= ely extremely extremely extremely extremely extremely long long long long l= ong long long long long long long long long long long long long long long= =2E ------G7YE98IGHS1BNE3I2L90D9ODGHKSOP Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><head></head><body>What is K-9 Mail doing with this when replying?<br= ><br><div class=3D"gmail_quote">On August 22, 2021 5:14:52 PM GMT+02:00, = <alice@domain=2Eexample> wrote:<blockquote class=3D"gmail_quote" style= =3D"margin: 0pt 0pt 0pt 0=2E8ex; border-left: 1px solid rgb(204, 204, 204);= padding-left: 1ex;"> <pre dir=3D"auto" class=3D"k9mail">A line extremely extremely extremely ex= tremely extremely extremely extremely extremely extremely extremely extreme= ly extremely long long long long long long long long long long long long lo= ng long long long long long long=2E<br></pre></blockquote></div></body></ht= ml> ------G7YE98IGHS1BNE3I2L90D9ODGHKSOP--
Screenshot
In Thunderbird the message is displayed like this:

Expected behavior
Use HTML that leads to the message being displayed in a sensible way by other clients. We probably shouldn't put the quoted text inside a <pre> tag.
I'm guessing the main problem is that we don't distinguish between HTML for local display and HTML that is included in outgoing messages.
Environment:
- K-9 Mail version: 5.900-SNAPSHOT (97b53fb685a0c6522c28bdaa5fbd5a141c036a06)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is identified in the issue. Start by tracing reply HTML generation and the distinction between locally displayed HTML and HTML included in outgoing messages; done means replies to text/plain-only messages render sensibly in other clients without relying on K-9 Mail-specific styling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100