Last yr, I introduced you 19 days of latest (to you) productiveness instruments for 2019. This yr, I am taking a special method: constructing an setting that can will let you be extra productive within the new yr, utilizing instruments you could or might not already be utilizing.
Index your e mail with Notmuch
Yesterday, I talked about how I take advantage of OfflineIMAP to sync my mail to my native machine. Today, I will discuss how I preprocess all that mail earlier than I learn it.
Maildir might be one of the helpful mail storage codecs on the market. And there are a LOT of instruments to assist with managing your mail. The one I hold coming again to is just a little program referred to as Notmuch that indexes, tags, and searches mail messages. And there are a number of applications that work with Notmuch to make it even simpler to deal with a considerable amount of mail.
Most Linux distributions embody Notmuch, and you may also get it for MacOS. Windows customers can entry it by way of Windows Subsystem for Linux (WSL), however it could require some extra tweaks.
On Notmuch’s very first run, it would ask you some questions and create a .notmuch-config file in your house listing. Next, index and tag all of your mail by working notmuch new. You can confirm it with notmuch search tag:new; this may discover all messages with the “new” tag. That’s in all probability plenty of mail since Notmuch makes use of the “new” tag to point messages which are new to it, so you may need to clear that up.
Run notmuch search tag:unread to seek out any unread messages; that ought to lead to quite a bit much less mail. To take away the “new” tag from messages you have already seen, run notmuch tag -new not tag:unread, which can seek for all messages with out the “unread” tag and take away the “new” tag from them. Now once you run notmuch search tag:new, it ought to present solely the unread mail messages.
Tagging messages in bulk might be extra helpful, although, since manually updating tags at each run could be actually tedious. The –batch command-line choice tells Notmuch to learn a number of strains of instructions and execute them. There can be the –input=filename choice, which reads instructions from a file and applies them. I’ve a file referred to as tagmail.notmuch that I take advantage of so as to add tags to mail that’s “new”; it seems to be one thing like this:
# Manage despatched, spam, and trash folders
-unread -new folder:Trash
-unread -new folder:Spam
-unread -new folder:Sent# Note mail despatched particularly to me (excluding bug mail)
+to-me to:kevin at sonney.com and tag:new and never tag:to-me# And be aware all mail despatched from me
+despatched from:kevin at sonney.com and tag:new and never tag:despatched# Remove the brand new tag from messages
-new tag:new
I can then run notmuch tag –input=tagmail.notmuch to bulk-process my mail messages after working notmuch new, after which I can search on these tags as nicely.
Notmuch additionally helps working pre- and post-new hooks. These scripts, saved in Maildir/.notmuch/hooks, outline actions to run earlier than (pre-new) and after (post-new) to index new mail with notmuch new. In yesterday’s article, I talked about utilizing OfflineIMAP to sync mail from my IMAP server. It’s very straightforward to run it from the “pre-new” hook:
#!/bin/bash
# Remove the brand new tag from messages which are nonetheless tagged as new
notmuch tag -new tag:new# Sync mail messages
offlineimap -a NativeSync -u quiet
You also can use the Python software afew, which interfaces with the Notmuch database, to tag issues like Mailing List and Spam for you. You can run afew from the post-new hook in an analogous means:
#!/bin/bash
# tag with my customized tags
notmuch tag --input=~/tagmail.notmuch# Run afew to tag new mail
afew -t -n
I like to recommend that when utilizing afew to tag messages, you do NOT use the [ListMailsFilter] since some mail handlers add obscure or downright junk List-ID headers to mail messages (I am you, Google).
At this level, any mail reader that helps Notmuch or Maildir can work with my e mail. I will generally use alot, a Notmuch-specific consumer, to learn mail on the console, but it surely’s not as fancy as another mail readers.
In the approaching days, I will present you another mail shoppers that can possible combine with instruments you already use. In the meantime, take a look at a number of the different instruments that work with Maildir mailboxes—you may discover a hidden gem I’ve not tried but.