Hi all,
This is just my attempt to document some of my experience with using
/mu4e/ on a Gmail account. Hopefully it'll be useful to someone. It'd be
even better if it results in me getting suggestions for improving my
setup :)
At first I configured /offlineimap/ to sync all my mail folders, i.e. I
had a folder for each Gmail label on top of the basic ones (Inbox, All
Mail, Drafts, etc.). This quickly led to strange situations where /mu4e/
would get confused about what was read, what was tagged, and so on. It
took a while for me to realise that all of my irritation was caused by
Gmail serving up duplicate emails. It's a strange thing Google does, so
it's not too surprising that /mu4e/ doesn't cope that well with having
multiple copies of the same email in many places. It doesn't manage to
execute its actions on all copies. Leaving me irritated with read emails
turning up as unread, deleted emails as undeleted, etc.
So, I thought I'd try the obvious approach to this problem: I'll avoid
having copies.
I removed all traces of my previous use of /offlineimap/ and /mu/ and
change my config to only sync the following four folders:
- All Mail
- Bin
- Drafts
- Spam
#+BEGIN_EXAMPLE
[Repository HomeRemote]
type = Gmail
remoteuser = XXX
remotepass = XXX
folderfilter = lambda folder: folder.startswith('[Gmail]/') and \
folder[8:] in ['All Mail', 'Bin', 'Drafts', 'Spam']
trashfolder = [Gmail]/Bin
maxconnections = 3
realdelete = no
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
#+END_EXAMPLE
I've then set /mu4e/ use those four folders like this
#+BEGIN_SRC elisp
(setq mu4e-sent-folder "/[Gmail].All Mail"
mu4e-drafts-folder "/[Gmail].Drafts"
mu4e-trash-folder "/[Gmail].Bin"
mu4e-refile-folder "/[Gmail].All Mail")
#+END_SRC
I now don't have an =INBOX= as such instead I've defined a few handy
bookmarks
#+BEGIN_SRC elisp
(setq mu4e-bookmarks `(("\\\\Inbox" "Inbox" ?i)
("flag:flagged" "Flagged messages" ?f)
(,(concat "flag:unread AND "
"NOT flag:trashed AND "
"NOT maildir:/[Gmail].Spam AND "
"NOT maildir:/[Gmail].Bin")
"Unread messages" ?u)))
#+END_SRC
The remaining problem is to propagate to Gmail that I've refiled
(archived) a message. I also noticed that flagging a message in /mu4e/
doesn't immediately mean the message is starred on the Gmail side. With
the recently added ~mu4e-mark-execute-pre-hook~ it becomes possible to
whip Gmail into doing my bidding :)
#+BEGIN_SRC elisp
(add-hook 'mu4e-mark-execute-pre-hook
(lambda (mark msg)
(cond ((member mark '(refile trash)) (mu4e-action-retag-message msg "-\\Inbox"))
((equal mark 'flag) (mu4e-action-retag-message msg "\\Starred"))
((equal mark 'unflag) (mu4e-action-retag-message msg "-\\Starred")))))
#+END_SRC
I've been using this for about a week now and I'm rather liking this setup so far.
It wasn't until after a couple of days that I realised this makes /mu4e/
more like Gmail than it was with me first setup, i.e. all email is in a
single folder and I use searching exclusively to find stuff :-)
/M
--
Magnus Therning OpenPGP: 0x927912051716CE39
email:
mag...@therning.org jabber:
mag...@therning.org
twitter: magthe
http://therning.org/magnus
The ultimate goal of all computer science is the program. The
performance of programs was once the noblest function of computer
science, and computer science was indispensable to great programs.
Today, programming and computer science exist in complacent isolation,
and can be [rescued only] by conscious coöperation and collaboration
of all programmers.