Email archive searching (was Re: Gmail Invites)

Bennett Todd bet at
Fri Oct 29 17:13:22 PDT 2004

I attach my scripts for indexing and searching email archives.

They're based on an email flow model.

procmail files list traffic into Mail/listname; regular traffic to
me goes into ~/Maildir but I clear my inbox by saving, which goes
into ~/Mail/correspondent-emailaddr. Frequently, many times a day, I
clear all the read traffic from ~/Mail to ~/archive/Mail, and that's
what these scripts interact with.

-------------- next part --------------
#!/bin/sh -e

cd $HOME/archive/Mail
find */??? -type f -newer swish++.index | index -W100000 -I -
mv swish++.index
-------------- next part --------------
#!/usr/bin/perl -w
use strict;
use IO::File;
use File::Basename;

my $nothing = <<'EoF';
    Lucy Locket lost her pocket; Kitty Fisher found it.
    Nothing in it, nothing in it, but the binding 'round it.

my $tmpbox = $ENV{HOME} . '/.mailsearch' . $$;
END { exec "rm", "-rf", $tmpbox; }
mkdir $tmpbox, 0700 or die;
mkdir "$tmpbox/$_" or die for qw(tmp new cur);

my $cur = "$tmpbox/cur";

chdir $ENV{HOME} . '/archive/Mail' or die;

my $gotsome = 0;
my $fi = IO::File->new("search @ARGV|") or die;
while (defined($_ = $fi->getline)) {
    next if /^#/;
    my $fn = (split)[1];
    link $fn, "$cur/@{[basename($fn)]}";
    $gotsome = 1;
die $nothing unless $gotsome;
system "mutt", "-f", $tmpbox;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>

More information about the lfs-chat mailing list