dylan conlin

Web Developer at Shortstack


Exposing Gmail’s Categories to IMAP

Unfortunately, gmail doesn’t expose its “Categories” to IMAP. I’m using mu4e as my email client, but I’d still like my mail categorized with gmail’s bayesian-or-whatever classifiers, so I found a fix.

This workaround uses filters to automatically apply labels to categories. Once labeled the old fashioned way, they can then be exposed to IMAP.

  1. Create a new filter via gmail/settings/filters

  2. Enter category:primary in the “Has the words” field and click “Create filter with this search.”

  3. Check “apply a label to this filter” and create the filter.

  4. Expose the filter to IMAP via gmail/settings/labels

If you’re using mu4e, run mu4e-update-mail-and-index and create shortcuts to your new folders. Mine looks like this:

  (setq mu4e-maildir-shortcuts
        '( ("/primary"             . ?i)
           ("/social"              . ?s)
           ("/promotions"          . ?p)
           ("/updates"
...

Continue reading →