Keeping with the 'search not sort' philosophy of mail, I have set up a system where when I get email (using 'getmail' to download it via pop from my email hosting) I deliver the email to two places. One is an archive (named for the day it was received on) and the other is an Inbox.
When I read email in the inbox, I delete it. The archive is always there.
I have a mairixrc configured to index all my archive. Unfortunately the globbing for mairix doesn't seem to work for subdirectories, so I have all my archives in
yyyymmddnamed folders instead of
yyyy/mm/ddfolders. This way I can say
Now that I have my email sorted like this, and mairix is indexing it (on a cronjob), I can search it. I wrote a little script to search my email. The idea is that I can select some text and click a button on my toolbar, or I can hit a button my toolbar and enter some text into a search prompt, then mutt will spawn pointed at a folder containing my search results.
Here is the one that prompts for input:
selection=$(Xdialog --inputbox "Search For?" 18 45 2>&1)
# exit if Xdialog had a nonzero exit.
[ $? -ne 0 ] && exit "Okay, nevermind"
echo Searching for $selection
mkdir -p $searchdir
mairix -o $searchdir "$selection"
mutt -f $searchdir
rm -rf $searchdir
The one that uses the xclipboard just does
selection=$(xclip -o)instead of the Xdialog dance.