thunderbird / thunderbird/thunderbird-android

Replying to a text/plain-only message generates unfavorable HTML

Open
#5,604 0 comments 0 reactions 0 assignees View on GitHub

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:

  1. Receive a text/plain message, 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
    
  2. Make sure Settings > [Account] > Sending mail > Message format is set to HTML.
  3. Reply to the message from step 1
  4. 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, =
    &lt;alice@domain=2Eexample&gt; 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:

image

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.