Monday, November 30, 2009

Thunderbird and IMAP - Immediately Showing Email Moves on the IMAP Server

I've been investigating an issue I was having with Thunderbird and IMAP.

The frustration was that any email or folder moves that were done in my Thunderbird client were not being reflected on the IMAP server until I either compacted the folders or closed the client.

So, for example, in Thunderbird I have multiple mail filters that automatically move incoming mail to specific folders based on content and source etc. If I leave my Thunderbird client open on my desktop, incoming messages all get automatically moved within Thunderbird; however, if I check on the IMAP server (via a web interface) or with another client (my iPhone) those messages are NOT shown as moved.

As mentioned, closing Thunderbird (or compacting the folders) forced the changes to the server.

I finally found the answer in a few places on the web - but it was a lot harder to find than I think the issue deserves, so I'm writing it down for myself ;-)

The problem is that apparently IMAP does not have a 'MOVE' command - the commands that are actually sent are a 'COPY' and 'DELETE'. So, what is apparently happening, is the copy command is sent when a filter is applied (you can check this - the emails actually appear in both locations), but the delete is deferred based on the settings in Thunderbird.

Thunderbird, by default (in 3.5.5 anyway) is set to only expunge deleted files (actually delete them) on close or compact. Now, this _may_ be solvable by just setting your Account Settings ->Server Settings to 'When I delete a message -> Remove it immediately' However, I did not want this - I wanted deleted files to be moved to the trash folder.

You'll also notice the 'Clean Up ("Expunge") Inbox on Exit' setting in the Account Settings location. Again, useful (may solve the problem) except it only updates when you exit the program (not useful).

The Better(tm) setting is in the advanced config.

Edit -> Preferences -> Advanced -> Config Editor
(you'll need to bypass the warning)

Change the Config entry:
mail.imap.expunge_after_delete to TRUE

This should make any email and folder moves and deletions done in Thunderbird available to other IMAP clients immediately.

1 comment:

  1. NOTE: You need to restart Thunderbird to have this setting take effect.