Tips and tricks for Mozilla Thunderbird, especially with an IMAP server

Composing in plain text, rather than email.  Turning off sending with Format=Flowed.  Turning off the strikethrough of the titles of messages which are tagged for deletion when using IMAP mailboxes. Clearing cached data if Thunderbird becomes confused and out of synch with the mailboxes on the IMAP server.  How to find the profile directory in Thunderbird: #profile-directory.

Robin Whittle rw@firstpr.com.au 2008-04-29
  (Corrected a problem on 2009-12-29)

../ Back to the parent directory concerning web-mail, modifications to Courier Maildrop etc.

Some of this is only relevant when Thunderbird is used with an IMAP server.  With IMAP, the server holds all (or at least some) of the mailboxes, rather than these being on the local PC.  This means that multiple PCs can be used to access the mailboxes.  IMAP works best via a LAN, but it can work over the global Internet.  Some email clients, including probably Thunderbird, may make hidden use of IMAP to discover the messages in all the mailboxes.  Since there could be tens of thousands of these, this may be a bad idea when the PC is mobile, operating via an expensive and slow wireless connection.  It is probably best to use a web-mail server which accesses the IMAP server instead, unless such behavior can be stopped.  I haven't yet tried to stop Thunderbird doing this, since I only use it on computers on the LAN on which my IMAP server resides.  

The long page which used to be here from about 2002 to April 2008 is available as a zip file in this directory: old-Mozilla-mail.zip . 

Composing plain text messages - not HTML

HTML emails suck in many respects. They are unreliable, and encourage people to accept HTML messages, which in general are more capable of causing security problems.  See my notes on the problems with HTML emails:  ../../sys-admin/HTML-email/ .

For every email account, I turn off the HTML message composition: Tools > Account settings > (account) > Composition and addressing > "Compose messages in HTML format" = No.  Then I can write plain text messages, except for the pesky "Format=Flowed" thing, which I hate . . .

Turning off the strikethrough of the details of messages which are "Tagged for Deletion"

Messages in an IMAP mailbox can be tagged for deletion.  A later command enables these messages to be physically deleted.

This is good in many respects.  Firstly, the user can "delete" and "undelete" the messages simply by pressing delete when one or more of them are selected in the mailbox's index.  

Secondly, with my modified version of Courier Maildrop and a suitable .mailfilter messages, such as those from mailing lists, can be delivered to the Inbox (or any other mailbox) already tagged for deletion.  This means I can still see their subject, sender, size etc. and read the messages.  I can also press Delete to remove this tag, or retag the message for deletion.  Once I have read my mailing list messages (I am on one or two dozen active lists) I use the Expunge command (File > Compact Folders - Alt F F on Windows) to get rid of all the mailing list messages, leaving only those I want to keep in my Inbox.

For this to be practical, the display of those messages should be with a red X to the left of the subject, and not with the subject, sender etc. being displayed with strikethrough text.  For instance:



The above shows my Inbox index, after a few mailing list messages (the list names are in square brackets) have arrived.  All these have been sorted by the mailfilter system on the server to send a copy into a mailbox for each list.  However the message is still sent to the Inbox, but tagged for deletion. The only one tagged for deletion here which was not like this was the spam message "Interesting ...".

Also, the account settings (Windows: under Tools, others under Edit) need to be set up so deletion tags the message for deletion, rather than moving it to the trash mailbox.  To do this: Server Settings > When I delete a message: "Mark it as deleted" (not "Move it to the Trash folder" or "Remove it immediately").

To get rid of this strikethrough, create a new directory (ooops - I had "text file" here for several years until I tried to follow my own instructions, without succes) in the profile directory (See #profile to find your profile directory) called "chrome" (if it wasn't there already).  Then in that directory create a file (if it wasn't there already) called: "userChrome.css".  In that file, have the following text:

treechildren::-moz-tree-cell-text(imapdeleted)
{
 text-decoration: none !important;
}
 

Then restart Thunderbird.

Other settings

In Options/Preferences > Display, turn off "Display emoticons as graphics", so that ":)" shows up as these characters, not a graphic image of a smiling face.

Disabling Format=Flowed when sending messages


Format=Flowed (RFC 2646) is a pesky (more like infuriating and stupid, I think - unless the sender makes an intelligent, informed and explicit choice to use it) way of sending an otherwise plain text email.  The outgoing email is different from what is written and with "Format=flowed" in the header, the receiving client is supposed to rewrap the text to whatever margins there are in the current display window.  The trouble is that this screws up the formatting of messages which have been deliberately manually formatted for good reason.

While it is possible for the reading client to turn off the display according to Format=Flowed, the most important thing when sending messages is to turn it off in the sending client.  For years, sending with Format=Flowed has been turned on by default, despite protests and reasons I mention in part below.

Sending with Format=Flowed on is not only on by default, for many years (it was introduced around 2002) there was no user-changeable option to turn it off.  Fortunately, now there is a way:

Open the Options/Preferences dialogue box. (Windows: Tools > Options, others: Edit > Preferences).

Select the Advanced section and the General tab within that.

From there, click the button "Config Editor".

Scroll down to find the item: mailnews.send_plaintext_flowed .

By default it is set to "true".  Double-clicking it will change it to "false".

Close this config-editor window with the X at the top right.

Close the main Options/Preferences dialogue box.

Arguments against sending with Format=Flowed

Very short version - my view with no explanation

"Format=flowed" is a lousy thing with certain potential benefits. 
The sending aspect of "format=flowed" mangles plain text messages by adding a space to the start of every line which begins with a space.  If the message is not received by a mail client program which knows how to decode "format=flowed" messages, then this mangling of the message remains.  So "format=flowed" is a supposed enhancement to plain text emails which generally stuffs up plain text messages sent to all non-"format=flowed" email clients.

The read aspect of "format=flowed" is not so disastrous since it only alters the display and printing of messages which have a header line indicating they were composed with "format=flowed" on. 

Since many people are sending "format=flowed" emails without knowing it, it is probably best to leave the read aspect of it on, in order to reverse the mangling of indented lines.  But this will also have the effect of rendering the message at a line width other that it was written at, depending on the current screen or paper width.  This may make it harder to read and the reforming may upset some important aspects of the message's layout.

More detailed version

"Format=flowed" is a way of sending plain text emails, and of receiving them, which has, or supposedly has, certain benefits for:
  1. Allowing the message to be displayed reasonably well with shorter and longer line lengths than it was originally written in.  This helps people reading a 72 character wide message on a 40 character screen on a cell-phone or PDA.  It can also make messages wider, but generally that is not a good idea for messages with lines which are already 70 or 80 characters long.  It can do this whilst reorganizing "> " quote characters in a reasonably sensible way, automatically.
  2. It can protect the message from a rare and not particularly serious degradation which only results if a line of the message begins with "From " and if the message is stored in an Mbox mailbox, rather than a better form of mailbox such as a Maildir, which involves no such degradation.  The degradation is that this line is changed to start with ">From ".  Local mailboxes in Mozilla are this sort of Mbox mailbox, I have been lead to believe.
  3. It may have other benefits.
When a message is sent by a MUA (Message User Agent = email client program) which is configured to send with "format=flowed" on, a number of transformations are made on the message when it is sent.  In the case of Mozilla, saving the message to Drafts causes the same things:
  1. In the message header, a distinctive header is added to tell the recipient MUA that the message should be interpreted as being in the "format=flowed" format.  This involves some transformations on the text, which (depending on the length of the lines it is re-interpreted to at the receiving end) are capable of reversing the changes made by the sending MUA:
  2. Any indented lines (as probably the majority of emails have) get an extra space added to them at the start.
  3. Some other changes with spaces at the ends of lines, including replacing a line full of spaces, or with lots of trailing spaces, with a version of the line minus those trailing spaces.
Mozilla was made to always send plain text with "format=flowed" some time in 2001 or 2002. 

In April 2002, I tested Mozilla's plain text email capability because I was really keen to use it for email and also browsing, to replace Netscape 4.77.  But I found that indented lines were having an extra line added.   I had no idea that this was anything to do with "format=flowed", although I had participated in debates in Bugzilla and on the Mozilla newsgroups about how plain text email, without any such things as "format=flowed" should be the default, with HTML etc. as easily selectable options.

The bug I submitted in April 2002 is here:  http://bugzilla.mozilla.org/show_bug.cgi?id=141983 "Space added to indented line when sending message".  This discussion is probably the Long Version! For a year it remained unfixed, though it was a high priority since it involved data loss and was a "showstopper" - causing me and other people not to be able to use Mozilla's Messenger at all. (In April 2008 it has been re-opened.  A 6 year old bug: "Severity: critical; Keywords: dataloss; Whiteboard: Behaviour conforms to spec." 

Although Burpmaster wrote a comment on 30 May 2002 which linked this bug to "format=flowed", neither I, nor seemingly anyone else made the connection.

On 4 May 2003 I found that the problem was caused by "format=flowed" being on when sending the message.  I assumed this was a fault in the "format=flowed" implementation, since I thought (as did most people, with the exception of Burpmaster) that "format=flowed" did its work without visibly altering the message as seen by non-"format=flowed" recipients (other than by adding or deleting trailing spaces).  (This was stated clearly by the Mozilla proponents of "format=flowed", including in the Mini-FAQs in their Evangelization bug (mentioned below).  But on examination we decided that "format=flowed" always adds a space to indented lines when sending the message.  Most of us believe this is utterly unacceptable.

Please see the above bug, and a few more, for the debate:  http://bugzilla.mozilla.org/show_bug.cgi?id=168420 We need Format=Flowed Evangelization and http://bugzilla.mozilla.org/show_bug.cgi?id=88986 Use > instead of grey bar for format=flowed quotes, optionally.

For many years it was only possible to turn this "feature" off by adding a line in a new file called "user.js" in the profile directory (See #profile here to find the profile directory):  

These two lines, if put in the user.js file as described, turn off the sending and reading of "format=flowed".  I suggest only using the first line.

  pref("mailnews.send_plaintext_flowed", false); // RFC 2646=======
  pref("mailnews.display.disable_format_flowed_support", true);


Deleting large mailboxes


Deleting thousands of messages can be painfully slow with Thunderbird.  It has to delete individual messages, which means it has to read their details, tell the IMAP server to tag each one for deletion etc.  Then the Expunge (Compact Folders) operation can take the IMAP server a long time.

For really large mailboxes, I often delete them by going into the file system itself with Midnight Commander, going into the /new or /cur directory and selecting all files (With PuTTY, hold down Alt and press the asterisk on the numeric keypad, or F9 and < or > to get the File menu, and then the Reverse Selection option there) and then use F8 to delete them all.  This is only suitable for geeks with shell access to the IMAP server.

If Thunderbird becomes confused

Sometimes Thunderbird becomes confused about the IMAP system in the server.  To fix this (Windows XP Thunderbird 2.0.0.12), I find its profile directory #profile-directory and then look into the Imapmail directory from there.  In that directory will be one or more directories, one for each IMAP server this profile of Thunderbird is configured to access.  

I delete that directory and restart Thunderbird.  

Finding the profile directory for Mozilla Thunderbird

(This section is linked to from ../../sys-admin/archiving-yahoo-groups/.)
 
This turns out to be quite tricky.

Below are some ways to find it without using Thunderbird itself, but first, what is probably an easier way:

In Account Settings (Windows: Tools or other systems under Edit) open the one (or one of) the email accounts and look in the Server Settings section.  At the bottom, is a thing called "Local Directory".  You may not be able to see it all, but Browse will enable the full thing to be discovered.  That has a "bunch of stuff" and then "/ImapMail/ ...".  The "bunch of stuff" is the profile directory.

The profile directory has a subdirectory such as "/Mail/Local Folders/" where local mailboxes are stored, as Mbox format mailboxes (single files, with all the messages one after the other).   

Here are the other ways of finding the profile directory.

There is a page: http://kb.mozillazine.org/Profile_folder which supposedly has all the answers.  However, Thunderbird doesn't use a directory "Mozilla" on Windows.  On my XP machine, it is at: C:\Documents and Settings\Robin Whittle\Application Data\Thunderbird\Profiles\jxyx17hl.default - where the jxyx17hl is pseudo-random and would be different for each separate Thunderbird installation and for each of the potentially multiple profiles.

On Debian, Icedove (the same as Thunderbird) has its profile directory at a location such as /home/robin/.mozilla-thunderbird/46k4973c.default .   

With CentOS 5.1, it is something like: /home/robin/.thunderbird/jcrlbe25.default .

Search engine bait: finding profile folder for Thunderbird.