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.
Create a new filter via gmail/settings/filters
Enter category:primary in the “Has the words” field and click “Create filter with this search.”
Check “apply a label to this filter” and create the filter.
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"
...