This is my personal configuration part of Notmuch-Multi in conjunction with pimacs/Notmuch.
With this configuration you can see how :
- Manage smartly multiple email accounts through Notmuch-Multi (see screenshots) ;
- The default Notmuch Key binding “j” permits to select one account by corresponding account prefix and next the corresponding key tag.
- In the
Notmuch Helloscreen, the Notmuch default key “G” synchronize the remote mails with local mails and apply the configured tags of new mails. - Implement mail completion composing message with both
BBDBand Notmuch Address Lookup tool ; - manage multiple sender identities with Gnus Alias.
- Place Notmuch hooks so
that so that the command
notmuch newautomatically move local mails to the right directory depending tags, retrieve remote mails withmbsyncand tags new local mails using the tags’ file configuration .notmuch-tagging and .notmuch-tagging-ovya.
The script install.sh does this :
- Safely symlinks ~~/Documents/mail/~ to ~~/Mail/~ (default value of my environment variable
$MAILDIR) because my important files are located in ~~/Documents/~. - Create the accounts’ directories
ivaldi.meandovya.frinto$MAILDIR. - Safely symlinks Notmuch hooks script to ~~/Mail/.notmuch/hooks~. See NOTMUCH-HOOKS manpages.
- Safely symlinks Notmuch scripts to my personal ~~/bin~ directory which is in
the
$PATHenvironment variable.- notmuch-tag-do.sh : Tags all new mails
- notmuch-tag-move.sh : move local mails to the related directories depending of tags values. For example, mail tagged “delete” will be removed.
- notmuch-notify.sh : notify with desktop popup when new mails are imported.
- Use Doom Emacs and the module pimacs/Notmuch. In order use the latest installed Notmuch Emacs UI instead of the version provided by Doom, IT IS IMPORTANT TO RUN ~doom sync -u~.
- Install Notmuch Address Lookup tool from source code (because I use the latest Emacs Notmuch UI).
- The source of the Notmuch Emacs UI must be in the directory
/usr/local/share/emacs/site-lisp(see the file packages.el)
If you don’t use Doom Emacs, the file config.el is easy to convert to pure Emacs lisp and you must install yourself the package Notmuch-Multi.
When gnus-alias was loaded the following commands must be used to set yours
identities and the rules to choice the correct identity :
M-x describe-variable RET gnus-alias-identity-alist M-x describe-variable RET gnus-alias-identity-rules M-x describe-variable RET gnus-alias-default-identity
I have something like this in the file custom.el
'(gnus-alias-default-identity "default")
'(gnus-alias-identity-alist
'(("default" "" "\"Philippe Ivaldi\" <xxxx@ivaldi.fr>" "Ivaldi"
(("X-Message-SMTP-Method" . "smtp 127.0.0.1")) "" "PI")
("ac-montpellier" "default" "\"Ph. Ivaldi\" <xxx@ac-montpellier.fr>"
"PIPRIME.FR" (("X-Message-SMTP-Method" . "smtp smtp.ac-montpellier.fr")) "" "")
("ovya" "default" "\"Philippe Ivaldi\" <xxx@ovya.com>" "OVYA"
(("X-Message-SMTP-Method" . "smtp smtp.gmail.com xxx@ovya.com")) ""
"Philippe Ivaldi, etc…")))
'(gnus-alias-identity-rules
'(("ac-montpellier" ("any" ".*ac-montpellier.fr.*" previous) "ac-montpellier")
("ovya_to" ("any" ".*@ovya.*" current) "ovya")
("ovya"
("any"
"\\(.*@ovya.*\\)\\|\\(.*@costes.*\\)\\|\\(.*@returnpath.com\\)"
both)
"ovya")))Note the field X-Message-SMTP-Method in the identities to configure each smtp server depending
the sender identity that correspond to an entry in the encrypted file
~~/.authinfo.gpg~ like this :
machine 127.0.0.1 login xxx@ivaldi.fr password xxxxxxxxxxxxxx port 1025
machine smtp.ac-montpellier.fr login xxx password xxxxxxxxxxx port 587
machine smtp.gmail.com login xxxx@ovya.com password xxxxxxxxxx port 587