ThunderBird support of RFC 3676 format=flowed is half-broken

Summary: RFC 3676 format=flowed is an elegant and backwards-compatible method to have plaintext emails reflowed on (mobile) devices that support this feature. Although this standard has been around for more than 10 years, and Thunderbird 45.3.0 reports supporting it, it only does so on non-quoted text. Most unfortunately, it wraps quoted text incorrectly, disabling reflowing on receiving devices, resulting in embarrassingly ugly email rendering.

What is RFC 3676 format=flowed?

Half of the people on the internet are of less than average intelligence. This is especially evident in discussions around format=flowed. To exacerbate matters, participants in most cases have not taken the time to actually read through RFC 3676 (go on, click the link!) and instead prefer to argue on the basis of their very strong emotions and opinions around text wrapping.

I would like to try and summarise very compactly what exactly format=flowed is and how it works.

Believe it or not, email can still be sent as plain text, i.e. not as HTML. Furthermore, this text is usually wrapped, i.e. newlines are inserted at a comfortable column width, e.g. 72 characters. This used to work wonderfully, until mobile devices came along. Because their screens often aren’t able to show the full 72 character width, the devices would be forced to wrap the text, resulting in a really ugly comb effect:

Someone sent me this really interesting
email. Unfortunately
it was wrapped so badly that I had difficulty
reading it. Even worse,
it made me like the sender of the email less.

To solve this problem, RFC 2646 was proposed (later to be superseded by its successor RFC 3676). All that had to happen, was that the sender could add a “format=flowed” to the outgoing email’s content-type, and wrap the email with both soft and hard line breaks (a line break in this case is a carriage return followed by a line feed, or CRLF). Soft line breaks, consisting of a space followed by CRLF, are used at the end of intra-paragraph lines, i.e. lines that could potentially be reflowed / joined. Hard line breaks, consisting of just the CRLF directly following the last character of the line, are used at the end of lines that should not be reflowed.

This meant that we could continue sending plaintext mails as we always did, with CRLFs exactly where we always had them. However, with format=flowed and a few extra spaces at strategic points, receiving devices that supported this format had the option of reflowing. Older devices would display the email exactly as they always had.

What is Thunderbird doing wrong?

In Thunderbird 45.3.0, format=flowed can be activated in Preferences | Advanced | Config Editor by setting mailnews.send_plaintext_flowed to true.

If you now start sending an email in plaintext mode, you’ll notice that Thunderbird is visually wrapping your text, i.e. it’s not inserting any hard line breaks. However, when you actually send the email, Thunderbird will replace all the visual line breaks with format=flowed soft line breaks. Your manually entered hard line breaks are maintained.

This is really great! Your emails render perfectly, even on smaller devices.

Unfortunately, when you reply to a correctly formatted format=flowed email, the quoted text is hard wrapped.

Viewing the message source with Emacs, we can see line breaks as $ characters. In the non-quoted part, the pink blocks are the expected spaces before each line break, meaning they will be treated as reflowable. However, in the quoted reply, there are no spaces before the line breaks, meaning they will be treated as unreflowable hard line breaks:

TB 45.3.0 hard wraps a quoted reply in format=flowed mode. Naughty Thunderbird!
TB 45.3.0 hard wraps a quoted reply in format=flowed mode. Naughty Thunderbird!

This is really very sad, and also quite unnecessary. When the email arrives on a mobile device, the quoted reply can’t be reflowed, and it looks like this:

Incorrectly soft-wrapped quoted reply can't be reflowed on my mobile device.
Incorrectly soft-wrapped quoted reply can’t be reflowed on my mobile device.

How embarrassing.

How ever will we be able to survive this catastrophe?

I have not been able to convince Thunderbird to soft-wrap quoted replies, even going so far as to insert the extra spaces myself. Thunderbird helpfully (not!) removes those spaces before sending the email, resulting in really embarrassing email rendering on receiving mobile devices that fully support format=flowed.

Edit | Rewrap in the compose window simply hard wraps everything, so it will only make things worse in the context of format=flowed.

I have also experimented with sending the quoted bits as really long lines (Emacs and the TB External Editor addon FTW). This displays nicely on modern mobile devices, but will result in infuriatingly long lines on MUAs that do not support flowed text.

Ideally, someone working on Thunderbird will realise that the current implementation desperately needs fixing, and will just do the job. Alternatively, someone will point me at a Thunderbird addon and source code I could modify to fix this behaviour. (If you’ve seen the multi-year arguments about text wrapping on the Thunderbird bug tracker, you’ll understand why I think an addon is a better bet than an externally suggested code change / pull request.)

I fear that I may be one of the last people still sending plaintext emails, so it might be that nothing will come of this desperate call for help. :)

 

Leave a Reply

Your email address will not be published. Required fields are marked *