Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

HTML generation from markdown leads to mis-detected quote in Fastmail

#2367

When generating HTML from markdown where a user is top-posting, MailMate produces something like this:

<div>
    <p>This is the main body of the email, which should not be hidden as a quote.</p>
    <p>On 1 Jan 1970, at 0:00, no one wrote (the important thing about this line is that it end with a colon):</p>
</div>
<blockquote>
    <p>Some text, blaha blah bah.</p>
    <div>
        <p>Here is the second line.</p>
        <hr>
        <p>Some more text.</p>
        <p>And some more.</p>
    </div>
</blockquote>

The important thing here is the attribution line (On XXX, YYY wrote...) has been put inside a <div> with the message body. The Fastmail webmail detects this attribution line and presumes the whole containing <div> is part of the attribution (this is detecting a multi-line attribution style Outlook can generate) so hides it along with the <blockquote>, mistakenly hiding the actual message.

It would be much better if the attribution line were not in the same <div> as the rest of the text when top-posting, or even better were inside a <div> with the <blockquote> and an easily detectable class (which is what Gmail does), e.g.

<div>
    <p>This is the main body of the email, which should not be hidden as a quote.</p>
</div>
<div class="mailmate_quoted">
    <p>On 1 Jan 1970, at 0:00, no one wrote (the important thing about this line is that it end with a colon):</p>
    <blockquote>
        <p>Some text, blaha blah bah.</p>
        <div>
            <p>Here is the second line.</p>
            <hr>
            <p>Some more text.</p>
            <p>And some more.</p>
        </div>
    </blockquote>
</div>

(Note, I am a developer at Fastmail, and I freely admit that this could equally be considered a bug in our heuristics for detecting quoted sections of a message. However, I do think the HTML MailMate generates makes it tricky to isolate the quoted section and makes it difficult to differentiate from the structure produced by some Outlook versions where this is all part of the attribution line.)

Reported by Neil Jenkins · July 20th, 2019 @ 08:32 PM

State: accepted
Milestone: none
Assigned to: benny benny

Activity

  1. benny
    benny
    • State changed from new to accepted

    Thanks for the feedback. I'm not sure I like the suggested solution since the attribution line is not part of the quoted content, but I also do not see any obvious alternatives :) Maybe I just need the attribution to be clearly marked as well:

    <div class="plaintext">  
        <p>This is the main body of the email, which should not be hidden as a quote.</p>
    </div>  
    <div class="quoted">  
        <div class="attribution">
            <p>On 1 Jan 1970, at 0:00, no one wrote (the important thing about this line is that it end with a colon):</p>
        </div>
        <blockquote>
            <p>Some text, blaha blah bah.</p>
        </blockquote>
    </div>
    

    As you probably know, these things can be very fragile and it's not unlikely that some other email client wouldn't expect this structure :)

    It's also not a straightforward change to make in MailMate (due to when the attribution line is generated), but I'll look into it and update this ticket if anything changes.

    August 1st, 2019 @ 08:39 AM

  2. benny
    benny

    I realize that Outlook has a non-blockquote style of quoting. In that case, a structure like the above would also make more sense (if email clients ever agreed on doing anything the same way).

    (I also have an open request to support generating a multi-line attribution.)

    August 1st, 2019 @ 08:46 AM

  3. Neil Jenkins
    Neil Jenkins

    I would have thought the simplest fix (and I would be surprised if it broke anything, as the structure is common), is to simply remove the <div> wrapping the content. This would be fine:

    <p>This is the main body of the email, which should not be hidden as a quote.</p>
    <p>On 1 Jan 1970, at 0:00, no one wrote (the important thing about this line is that it end with a colon):</p>
    <blockquote>
        <p>Some text, blaha blah bah.</p>
        <div>
            <p>Here is the second line.</p>
            <hr>
            <p>Some more text.</p>
            <p>And some more.</p>
        </div>
    </blockquote>
    

    August 1st, 2019 @ 02:09 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.