I’ve previously blogged about why mu4e is a great emacs mode for managing large email mailboxes. Here’s a way to find emails you can delete in bulk by grouping all emails by a given field and counting the frequencies. You will to have mu and xmlstarlet installed.
For example, between 3rd March 2009 and 17th August 2014, to group by the subject field,
$ mu find --format=xml date:20090303..20140817 | \ xmlstarlet sel -t -v "/messages/message/subject" | \ sort -nr | uniq -c | sort -nr | less
The results will shown in order of subject frequency across all mailbox folders:
166 Coffee break? 121 Automatic reply: I'm locked in the freezer send help 91 RE: do you have my coffee cup? 14 funny cat video 9 Re: accommodation confirmed 4 Re: survey, cat vs dog vids
Alternatively, you might want to delete those “Automatic reply” spam emails:
$ mu find --format=xml date:20080101..20140817 | \ xmlstarlet sel -t -v "/messages/message/subject" | \ grep "Automatic reply" | sort -nr | uniq -c | sort -nr | less
These email threads can then be deleted with the
D flag in mu4e in emacs. Huzzah, a decluttered mailbox.