* Re: Best practices for notmuch and neomutt
2020-03-03 11:13 Best practices for notmuch and neomutt moonmaillist
@ 2020-03-03 19:48 ` Reto
2020-03-03 21:10 ` Kim ALLAMANDOLA
1 sibling, 0 replies; 3+ messages in thread
From: Reto @ 2020-03-03 19:48 UTC (permalink / raw)
To: moonmaillist; +Cc: notmuch
On Tue, Mar 03, 2020 at 11:13:47AM +0000, moonmaillist@firemail.cc wrote:
> I really want to know best practices or nice virtual-mailboxes, which aren't
> included in normal tutorials. Most tutorial just have 1 email address and
> only use tags like inbox, archive, deleted and spam. But there must be much
> better use cases and much more detailed notmuch queries or even hooks which
> are triggered to specific events.
I mean in the end you need to make up a system that works for you.
I personally just tag it by topic (notmuch / neomutt / distro related...)
possibilities are endless.
But the more tags you have the harder it gets to keep track and make sense of them.
I dump all mails from 3 addresses into one notmuch db.
The necessary tricks to cope with that is in neomutt
```
set sendmail="/bin/msmtp --read-envelope-from"
set use_from=yes
set reverse_name
set envelope_from=no
# special case for lists, where we aren't explicitly on the to/cc headers
reply-hook . 'unmy_hdr From:'
reply-hook '~h"Delivered-To: asdf@gmail\.com"' my_hdr from: asdf@gmail.com
reply-hook '~h"Delivered-To: xyz@stuff\.com"' my_hdr from: xyz@stuff.com
```
While that may not be the most elegant solution, at least it works.
On the notmuch side I just use a after sync script containing all the tagging
```
#first put all in the inbox
notmuch tag +inbox -- tag:new
#temporary tag which will be removed at the end
for email in ${own_adresses[@]}; do
notmuch tag +to_me -- "to:${email} and tag:new"
done
for email in ${own_adresses[@]}; do
notmuch tag +sent -- "from:${email} and tag:new"
done
# then remove all the non inbox stuff one by one
# filter stuff we sent from the inbox if it isn't a self message
notmuch tag -inbox -- tag:sent and not tag:to_me
notmuch tag -inbox +lists +notmuch -- to:notmuch and tag:new
# kill muted threads
notmuch search --output=threads tag:muted | xargs -r -n1 notmuch tag +muted
#get rid of old clutter from mailing lists
notmuch tag +archive -- tag:lists and date:..30d and not tag:unread
#archived stuff should not be unread
notmuch tag -unread -- tag:unread and tag:archive
#finally remove the temporary tags
notmuch tag -new -to_me -- tag:new
```
Stuff like that...
Does this help?
Greetings,
Reto
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Best practices for notmuch and neomutt
2020-03-03 11:13 Best practices for notmuch and neomutt moonmaillist
2020-03-03 19:48 ` Reto
@ 2020-03-03 21:10 ` Kim ALLAMANDOLA
1 sibling, 0 replies; 3+ messages in thread
From: Kim ALLAMANDOLA @ 2020-03-03 21:10 UTC (permalink / raw)
To: moonmaillist; +Cc: notmuch
Hi,
mine it's not really a neomutt workflow, but a notmuch one (I use
notmuch-emacs), I do not know how much can be ported to neomutt
but...
I use tags a bit, with afew as autotagger. In the past I've used
a simple script that wrap
notmuch tag --batch <<EOM
+tag query
+othertag otherquery
...
EOM
But I decide to switch for afew due to it's move mail mode to
autorefile messages, using tags as driver, for instance mail
from my ISP, get few tags: s/FreeBox and s/ISP, if there is a
certain subject and an attachment also d/invoices. Afew in mail
move mode grab from INBOX any new message tagged with s/FreeBox
and move the mail to the corresponding directory, named after
the tag. Also refile sent messages to the appropriate directory,
if any.
The tags taxonomy is essentially
- ml/ for mailing lists
- s/ for stakeholders
- v/ for vendors
- p/ for people
- c/ comment/social networks
- n/ messages form bot/notification/automatic systems etc
- a/ alert, a subset of n/
- x/ appointments and others agenda related
- w/ work related
- t/ taxonomy|account related like t/account1/sent etc
- A/ aliases (I have many, essentially one per correspondent)
- ...
For instance these messages get ml/notmuch tag. If Neomutt can
"browse" virtual folders created after notmuch queries I think
it can be applied without issues.
Then I have saved searches like
- unread (group all unread messages from any account and dir.)
- critical a query for messages that can be critical (system failures,
home CCTV alerts, ...), a subset of unread
- important as above another subset of unread
- live read messages about "inprogress things"
- notes (quick autosent notes from myself)
I have 4 mail account, all under a common ~/mail maildir, indexed by
notmuch, tags are mostly used to help searches when I do not want to
type queries or I do not found something easily with a query.
Maildir taxonomy is similar to tags
~/mail/account1/{s/,v/,...}
~/mail/account2/{s/,v/,...}
~/mail/account3/{s/,v/,...}
~/mail/account4/{s/,v/,...}
the practical difference is that not all tags have a correspondent
directory and messages are not duplicated while I have many tags
per messages...
In the past I've used IMAPFilter, it's far superior than afew for
filtering (refiling mails) but it lack notmuch integration so I
drop it.
For trying to keep my maildir clean I have a periodic "cleaner",
a simple series of notmuch queries piped to rm that collect
messages by dates and "kind" (tag). For instance messages about
shipment notifications from Amazon/eBay/Aliexpress/... get
deleted if not flagged and older that 356 days, messages from
certain people not flagged get deleted after two years etc. It
does not work much in the sense that my maildir keeps growing but
work enough for now... Periodically when an idea pops up I add
another query with another deletion...
I've tried a bit more automation, with uudeview, mblaze, pdfgrep
etc for instance to extract invoices from my ISP, utility bills etc
and archive the pdf with a proper file name in a proper taxonomy,
adding an entry in my org-agenda, journal, looking after a certain
period of time if my ledger contains the correspondent transaction
and adding an alert in agenda if it's not found etc. but after a
first spaghetti-code script implementation for my ISP and mobile
carrier I quit, it's simply too long an too much "specific" to
be useful, too much work to keep it up than the work needed to
do the same manually.
I've used in the past RSS2Email so I can read my feeds via mail,
have the indexed by notmuch, easy to share if I wish etc but due
to the actual status of feeds where most sites only push a title
and a link to the real article I quit since I can't really read
feeds without a browser so it's not useful have them archived.
A real shame... Miniflux (a feed reader) have some mechanism to
download the article for site that does not push it, but I do
not know how to implement it via mail so I quit, it's too much
work.
Last but not least: the real key to do all the above is IME have
tons of alias so querying them is easy, without the to: queries
it will be really hard to keep anything "safely working".
-- Kim
^ permalink raw reply [flat|nested] 3+ messages in thread