I know I’ve written a lot about Emacs and email lately but I can’t help myself—Stop me before I post again!—because there’s so much interesting material. Recently, I saw a pointer to a post from Martin Albrecht on his setup for using mu4e for email. More than most posts on the subject that I’ve seen, Albrecht has a carefully thought out, complete environment for email.
That includes such things as arranging to have email retrieved from his IMAP server on demand rather than constantly polling to see if there’s mail available, providing for footnotes in emails, using YASnippet to help generate boilerplate emails, arranging for special characters such as round quotation marks and math symbols to be used in the message body, and automatically using the correct dictionary depending on whether he is writing in English or German.
His solution for retrieving mail is particularly interesting. Rather than set a timer to have mbsync
(or whatever) check for mail, he uses imapnotify to fire off mbsync
when the server tells him there is mail ready. After mbsync
finishes, imapnotify
runs mu
to index the new mail. This is how the native Mail app on macOS operates and it’s the one thing I’ve missed since moving to mu4e
. As far as I can tell, imapnotify
doesn’t run on macOS but it’s written in node.js (I think) so there’s probably no reason it couldn’t. Sadly, I don’t know anything about JavaScript, let alone node.js, but I’ve thought about adding a Mail app rule to fire off some Apple Script when mail arrives to do this, or perhaps using Automator somehow.
If you’re running on Linux and using mu4e
and mbsync
you should definitely take a look at Albrecht’s solution if your IMAP server supports IMAP IDLE. Actually, every Emacs user should take a look at his setup. It may give you a better email environment than you have now.