2008-12-13

Mairix and Mutt for Mail

After a long time of using webmail and things, I've finally gotten around to hosting my mail locally on my computer.

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 yyyymmdd named folders instead of yyyy/mm/dd folders. This way I can say maildir=Maildir/Archive/*.

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:
#!/bin/sh

searchdir=/var/tmp/searchresult-$$
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.

3 comments:

massysett said...

The bit about copying the incomings to an inbox and an archive and just deleting from the inbox is awesome! I was thinking of using mairix but puzzled over how to deleet from the inbox, seeing as mairix gives you a pile of symlinks.

ahmed said...

استخدام جميع الأدوات الحديثة التي توفر الوقت في التنظيف ، وكذلك تبني منظفات جيدة وفعالة في التخلص من أصعب البقع وأكثرها لزجة.
شركة النجوم لخدمات التنظيف
شركة تنظيف شقق بمكة
شركة تنظيف بيوت بمكة
شركة نقل عفش بمكة

Nathan William said...

This type of essay writing is like painting a picture. The writer paints a detailed and vivid picture through his/her words. You might have to describe the person, place, object, memory or some special significance. The main aim of descriptive essays is to convey a deeper meaning to the readers. essay writer can guide you to write descriptive essays.

Our online plagiarism checker tool also reflects our transparency as students can easily check for accuracy of the tasks our writers provide. The tool also helps students become acquainted with what constitutes plagiarism.