Label-Driven Email
Instead of organizing emails by maildirs, you can use GMail's all-label way of categorizing emails. GMail keeps all emails in one "maildir" called "[Gmail]/All Mail", which I have offlineimap map to a maildir called "Archive". You need only sync Archive and Trash. Rely on labels to formulate mu4e "bookmarks." Emails with the label:
-
\Inbox
are what you see in your GMail inbox (all categories Primary, Social, etc.),
-
\Spam
for what GMail considers spam,
-
\Draft
for drafts emails,
-
\Trash
deleted emails scheduled for purging per GMail settings, and
-
Whatever
your "folder names" are just labels of the same name (no leading backslash). Sub-folders are separated with a slash:
Business/Urgent
, for example.
Accessing GMail Categories
One of the difficulties of integrating mu4e with GMail, is getting access to the very helpful "Categories" assigned by GMail to incoming emails. There is nothing in the email header to indicate the category. You can fix this by creating a filter in GMail that applies a label to emails based on their categories. Add a filter with the following in the "Has the words field": category:(promotions), or category:(primary), etc. In the action, tell GMail to apply a label, such as "CatPromotions". Now, you can use the label in a mu4e search to handle Gmail categories as you like. For example, filter for unread inbox with "x:CategoryPrimary" as one of the selectors.
Example GMail Inbox Bookmark
(with-eval-after-load 'mu4e
(setq mu4e-bookmarks
`(,(make-mu4e-bookmark
:name "Inbox"
:query "x:\\\\Inbox and x:CatPrimary and m:/Archive and not g:list"
:key ?i)
,(make-mu4e-bookmark
:name "Unread Inbox"
:query "x:\\\\Inbox and x:CatPrimary and m:/Archive and g:unread and not g:list"
:key ?I)
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by ddoherty03