I'm a huge fan of mutt mail reader and Maildir.
My mutt spawn vim in console, and I can chat with anyone as fast, as in any faddish messenger.
Maildir is cool.
The following bash script I use to print info about new emails in Maildir (From and Subject):
#!/bin/bash
if [ ! -z "$(ls -A ~/Maildir/new/)" ]; then
cat ~/Maildir/new/* | grep "^\(From\|Subject\):"
fi
(Adjust it to your folders.)
This script prints new email counts in each Maildir folder:
#!/bin/bash
cd ~/Maildir
find . -name new | sort |
while read LINE;
do
files=$(find "$LINE" -type f -name '*' -print | wc -l)
if [ "$files" != "0" ]; then
echo $LINE - $files | sed 's/\/new//g'
fi
done
Sample result:
./.Archives - 4 ./.mail-lists - 2 ./notifications - 1 ./.SPAM - 8 ./.Trash - 105
Now about mailing lists I'm subscribed to. Can I see a statistics, what today's trends are?
% cd ~/Maildir/.mail-lists/cur
% cat * | grep "^Subj" | sort | uniq -c | sort -n
10 Subject: Re: [Tinycc-devel] Unable to find include directories by tcc on
12 Subject: Re: Any missed features?
12 Subject: Re: [Tinycc-devel] manually inlining functions
12 Subject: Re: [Tinycc-devel] [PATCH 3/3] stdatomic: stdatomic.h header
12 Subject: Re: [Tinycc-devel] -Werror=X (but ugly)
12 Subject: Re: [Tinycc-devel] x86_64 tcc doesn't set sign bit on NaNs
13 Subject: Re: [Tinycc-devel] Outdated .def files
14 Subject: Re: Check witness validity with benchexec?
14 Subject: Re: Help testing release candidate / mc-4.8.27-rc1
17 Subject: Re: [Tinycc-devel] [PATCH] stdatomic: ld/st/xchg/cmpxchg on simple
21 Subject: Re: [Tinycc-devel] issues/questions with stddef.h which comes with
24 Subject: Re: [Tinycc-devel] enforced immutability - proposed research project
29 Subject: Re: [Tinycc-devel] Linking system dylibs on macOS 11+
32 Subject: Re: [Tinycc-devel] Segfault on arm64 when making a function call
53 Subject: [cwn] Attn: Development Editor, Latest OCaml Weekly News
What activity on github's projects I'm subscribed to?
% cd ~/Maildir/.mail-lists/cur
% cat * | grep "^To.*github" | sort | uniq -c | sort -n
229 To: sosy-lab/sv-benchmarks
238 To: 9fans/plan9port
328 To: MiniZinc/libminizinc
438 To: stp/stp
684 To: vprover/vampire
714 To: klee/klee
1301 To: tlaplus/tlaplus
2732 To: angr/angr
4455 To: Z3Prover/z3
5358 To: CVC4/CVC4
9311 To: diffblue/cbmc
9331 To: cvc5/cvc5
% cat * | grep "^Subj" | sort | uniq -c | sort -n
63 Subject: Re: [Z3Prover/z3] [Consolidated] soundness issues, invalid models,
66 Subject: Re: [diffblue/cbmc] Adds documentation about function contracts
67 Subject: Re: [vprover/vampire] Induction with recursive functions (#259)
71 Subject: Re: [CVC4/CVC4] Optimizer for BitVectors (#6213)
72 Subject: Re: [diffblue/cbmc] Allow checks to be performed inside quantifier
78 Subject: Re: [diffblue/cbmc] Cache dereferences during symex to avoid
86 Subject: Re: [Z3Prover/z3] [Consolidated] issues affecting
97 Subject: Re: [Z3Prover/z3] [Consolidated] issues with
104 Subject: Re: [CVC4/CVC4] Replace old sygus term reconstruction algorithm with
109 Subject: Re: [diffblue/cbmc] Add support for assigns clauses on loops (#6249)
119 Subject: Re: [CVC4/CVC4] Add Solver.java to the Java API (#6196)
134 Subject: Re: [CVC4/CVC4] Refactor / reimplement statistics (#6162)
137 Subject: Re: [Z3Prover/z3] Add move semantics to c++ api (#5156)
141 Subject: [Z3Prover/z3] Pre-release Nightly - Nightly
144 Subject: [aimacode/aima-exercises] Request to get Community solution for
233 Subject: Re: [tlaplus/tlaplus] Trace explorer fixes and enhancements (#588)
For some Maildir folder (mailing list, correspondence with someone), get activity by years:
% cat * | grep "^Date: " | cut -d ' ' -f5 | sort | uniq -c 53 2020 109 2021 80 2022 44 2023 59 2024
By month and years:
% cat * | grep "^Date: " | cut -d ' ' -f4,5 | sort | uniq -c 12 Apr 2021 1 Apr 2022 7 Apr 2023 9 Apr 2024 7 Aug 2020 6 Aug 2021 10 Aug 2022 2 Aug 2023 3 Aug 2024 15 Dec 2020 ...
(Not correctly sorted, by OK.)
Can you do this in your favorite email client? Or maybe google mail, god forbid me?
I also use mairix as a search engine for my Maildir emails. (The only issue with it is that it can't handle utf-8.)
I probably should upgrade to mu
Anyway, call this Python script from mutt ('|' (Pipe to command), then type ./search.py). The 'From' field of the email message you're currently at will be passed to the script:
#!/usr/bin/env python3
import fileinput, os
for line in fileinput.input():
if line.startswith ("From:"):
line=line.split()
s=line[-1]
if s[0]=='<' and s[-1]=='>':
s=s[1:]
s=s[:-1]
print (s)
os.system ("mairix -f ~/mail/.mairixrc tf:" + s)
exit(0)
print ("Error, can't parse this: ",line)
Depending on mairix's config file, all your correspondence with that email will be gathered in 'Search' folder, which can be browsed in mutt.
Easily trim SPAM and Trash folders:
echo -ne files removed in .SPAM: find ~/Maildir_main/.SPAM -mindepth 1 -mtime +30 -print -delete | wc -l echo -ne files removed in .Trash: find ~/Maildir_main/.Trash -mindepth 1 -mtime +30 -print -delete | wc -l
Moving emails is very easy in mc (midnight commander). Because each email is a single file. Also, filename starts with Unix timestamp, so that all files are sorted.

Yes, I know about these lousy Disqus ads. Please use adblocker. I would consider to subscribe to 'pro' version of Disqus if the signal/noise ratio in comments would be good enough.