Tuesday, 16 June 2009

GMail with Evolution and the trash bin: how to organize mails and delete GMail messages

In part I of this series of posts (well, what meant to be just one post but it's going to explode...) I explored the basic configuration you need to setup Evolution as your GMail client. I also told you about GMail labels. labels are a mechanism to extend the concept of folders (in this case, IMAP folders): GMail servers indeed store just one copy of a message and if a message is labeled multiple times, the message will appear in all the corresponding folders. Label work just like UNIX hard links.

Folder names and GMail internal folders

GMail will provide one IMAP folder per label whose name will be the label's name. So far, so good. Now: GMail also uses some special folders to operate internally and you'll see them in the IMAP tree. These folders are:
  • [GMail]/All Mail
  • [GMail]/Drafts
  • [GMail]/Sent Mail
  • [GMail]/Spam
  • [GMail]/Starred
  • [GMail]/Trash
You really shouldn't use them but believe me, they just do what they say. Is it clearer why on part I we modified the default settings for some folders?
  • The [GMail]/Drafts folder is visible in GMail web interface, so it's very handy to have Evolution save drafts directly there: you could start a message on Evolution, save it, and then sending it from you mobile device. You should be aware of a gotcha: if you're editing a message with a large attachment beware that when the mail client saves it, it will indeed send the attachment to the server! In such cases, I just attach the file at last.
  • The [GMail]/All Mail folder contains a link to every single message in your account. That's why you should never store messages directly here unless you know what to do. We'll get into this later.
  • The [GMail]/Sent folder contains a link to every message you sent. GMail does this automatically for you: the message will be stored on the server and labeled accordingly. That's why you don't have to save sent messages on the server. You would simply waste bandwith!
  • The [GMail]/Starred folder contains a reference to starred messages. One more time you realize that everything's built around labels.
  • The [GMail]/Trash label is very special. We'll get into this later.

Copying and moving messages

The file metaphor still applies:
  • Copying a mail from a folder to another is equivalent to label a message with the destination folder's label.
  • Moving a mail from a folder to another means removing the origin folder's label and applying the destination folder's label.
In the introduction, I said that labels are similar to UNIX hard links. Yes, but there's an important difference: a mail isn't unlinked when its label counter is 0 and a mail can be unlinked even if its label counter is greater than 0.

Deleting messages

This is where things may not be so intuitive. I'll try to make it clera with an example: when you receive a message (and you don't have any auto-labeling filter triggered by such message), that email goes into the Inbox. Moreover, that message will automagically appear into the [GMail]/All Mails folder. Now: what's the IMAP gesture that corresponds to archiving such message? A valid answer would be: moving it to the [GMail]/All Mails folder. This would indeed translate to:
  1. Removing the GMail internal Inbox label.
  2. Applying the [GMail]/All Mails label (which is already applied to every message).
Thus, the only action you could perform would be removing the Inbox label and you could do it in a bunch of ways including:
  • Moving the message to a local (non-GMail) folder: this folder could also be the Evolution local Trash folder.
What has happened, then? Well: you think you deleted a message whereas you simply archived it. This is also true when multiple labels are applied. You can remove one label, but the same message could still be appearing in another n IMAP folders because of the remaining labels! How can you remove a message, then? Think about GMail web interface: when you delete a message, no matter the number of labels applied, what happens is that GMail is labeling it with the magic [GMail]/Trash label!
No matter how many labels a message has, labeling it with the [GMail]/Trash label effectively tell GMail to delete it in 30 days.
If you want to delete a message, then, just move it to the corresponding [GMail]/Trash folder of your account.

Is there a better way to do it?

I recognize that renouncing to the comfortable Delete button and having to move a message into the [GMail]/Trash folder is neither intuitive (semantically) nor easy: one click is addictive, a (right-click, move, choose folder) sequence is just a pain.

I had to cope with the same issue in Thunderbird but, fortunately, Thunderbird was easy enough to tweak in order to map the Delete action into the corresponding GMail action. It basically reduced to mapping the local Trash folder into the remote [GMail]/Trash folder and it could be easily accomplished manually editing the trash_folder_name property of each account.

I haven't (yet) found a way to do it with Evolution and I'll spend a couple of hours more to investigate it.

No comments:

Post a Comment