Update 12/2012: The manual has a short updated chapter on this subject.

MailMate encourages the use of a single mailbox for archiving messages (for each IMAP account). This concept is similar to the All Mail mailbox in Gmail (Googles free webmail service) and one might think that Gmail would be a perfect match for MailMate since Gmail supports the IMAP protocol. Unfortunately that is not quite the case. The main reason is how they chose to map the concept of labels in Gmail to some representation in the IMAP protocol. IMAP does support so-called flags, but this was probably not well supported in many clients and it would require users to manually setup smart mailboxes for all Gmail labels in order to actually view them as mailboxes like in the webmail interface. Google chose a different approach which can be best described as a hack.

Each label in Gmail becomes a real mailbox when accessing the messages via IMAP. Existing email clients do not expect this and the result is that each message is fetched multiple times, once for each of its labels. Even if not using labels, the problem persists since every message in Inbox, Sent Mail or Drafts are also located in All Mail. In MailMate it becomes even worse because of the special All Messages mailbox which is going to include all the duplicates.

There are other issues when accessing Gmail via IMAP, but the purpose of this blog post is to simply state what I currently consider the most sensible settings in MailMate for a Gmail account. Unfortunately part of this means that you are not going to be able to access labels within MailMate.

  • Edit the subscriptions of the Gmail account such that the following mailboxes are unsubscribed: [Gmail]/All Mail, [Gmail]/Starred and all labels.
  • Create a mailbox in the webmail interface named [Gmail]/Archive.
  • Map Gmail standard mailboxes to the standard mailboxes of MailMate. This is done by default for new Gmail accounts in MailMate (probably only works for the English language, but this is untested – UPDATE 28/8-2011: should work for all accounts now). You can also do this manually, e.g., select the [Gmail]/Drafts mailbox and open the context sensitive menu where you can set the mailbox type to Drafts. Do the same for all of the other standard mailboxes.
  • Create a filter in the gmail interface which automatically labels any new incoming messages with the [Gmail]/Archive label. UPDATE: This is not a good solution since it is going to result in duplicate messages in MailMate (Inbox and Archive). Alternative ideas are welcome.

Apart from missing labels, the main problem with the above is that you can no longer access messages which are only in the All Mail mailbox. To be able to access these you need to mark them all with the [Gmail]/Archive label. This can be done as follows within the webmail client:

  • Mark all conversations in All Mail as [Gmail]/Archive.
  • Remove the [Gmail]/Archive label from all messages in the Inbox and any other standard mailboxes (not those in Starred!)

If your actual use of labels is to use them as mailboxes, i.e., at most one label per message then you can still subscribe to them. Such messages should not have the [Gmail]/Archive label.

Note that Gmail has a so-called lab (experimental features) which provides a few more IMAP configuration options. It is named “Advanced IMAP Controls”. You do not need this to make the above work, but it could be useful for other email clients.