Mu4e: More robust Gmail account checking

Emails sent to an @gmail.com account may have been forwarded to a non-gmail mailbox.
Thus the current approach is over-eager.

Only checking @gmail on send, and then matching a user's maildir (not email) with
received messages is a more robust approach.

To accommodate this we switch `+mu4e-gmail-addresses' out for `+mu4e-gmail-accounts'.

Along the way `mu4e-index-cleanup' and `mu4e-index-lazy-check' customisations were
moved into the readme as a recommendation for Gmail-only users, to avoid causing
adverse effects for users who have non-gmail accounts too.
This commit is contained in:
TEC 2021-01-17 13:49:10 -06:00
parent 611e532d38
commit 2307ae5644
No known key found for this signature in database
GPG key ID: 779591AFDB81F06C
2 changed files with 39 additions and 32 deletions

View file

@ -173,10 +173,30 @@ Then configure Emacs to use your email address:
With the =+gmail= flag, integrations are applied which account for the different
behaviour of Gmail.
The integrations are applied when using addresses which contain =@gmail.com= or
have =gmail= in the maildir name. You can use ~+mu4e-gmail-addresses~ when you want
an address to be treated as such but it meets neither conditions (e.g. with
Gsuite).
The integrations are applied to addresses with /both/ "@gmail.com" in the
account address and "gmail" in the account maildir, as well as accounts listed
in ~+mu4e-gmail-accounts~. Any domain can be specified, so G Suite accounts can
benefit from the integrations:
#+begin_src emacs-lisp
;; if "gmail" is missing from the address or maildir, the account must be listed here
(setq +mu4e-gmail-accounts '(("hlissner@gmail.com" . "/hlissner")
("example@example.com" . "/example")))
#+end_src
If you only use Gmail, you can improve performance due to the way Gmail
presents messages over IMAP:
#+begin_src emacs-lisp
;; don't need to run cleanup after indexing for gmail
(setq mu4e-index-cleanup nil
;; because gmail uses labels as folders we can use lazy check since
;; messages don't really "move"
mu4e-index-lazy-check t)
#+end_src
Also, note that Gmail's IMAP settings must have "When I mark a message in IMAP
as deleted: Auto-Expunge off - Wait for the client to update the server." and
"When a message is marked as deleted and expunged from the last visible IMAP
folder: Move the message to the trash" for the integrations to work as expected.
** OrgMsg
With the =+org= flag, =org-msg= is installed, and ~org-msg-mode~ is enabled before