* Michael Tatge <[EMAIL PROTECTED]> [2002-10-01 14:17]:
> Why don't you run a little shell or perl script against that folder?

Hmm...

  #!/usr/bin/perl

  use strict;

  use File::Slurp;
  use Email::Find;

  my (%addrs, $data, $mbox, $finder);

  $data = read_file("mutt-users");      # read_file comes from File::Slurp
  $mbox = "$ENV{HOME}/Mail/lists/mutt-users";

  $finder = Email::Find->new(sub { $addrs{ $_[0]->format }++ });
  $finder->find(\$data);

  print join "\n", sort keys %addrs;

This works, assuming you have File::Slurp and Email::Find installed.
The problem with this, though, is that it picks up Message-ID's.

A more robust solution (involving Perl) would be to create a Mail::Box
instance, that knows about the messages it contains, and then grab email
addresses from the appropriate header fields.  This would also work for
things other than mbox format:

  use Email::Find;
  use Mail::Box::Manager;
  my %addrs;
  my $mgr = Mail::Box::Manager->new;
  my $mbox = $mgr->open(folder => "Mail/INBOX/");
  my $finder = Email::Find->new(sub { $addrs{ $_[0]->format }++ });

  for my $message ($mbox->messages) {
      my $cc = $message->cc;
      my $from = $message->from;
      $finder->find(\$cc);
      $finder->find(\$from);
  }

  print join "\n", sort keys %addrs;

(Note that I've tested the first, but not the second.)

(darren)

-- 
It is impossible to travel faster than the speed of light, and
certainly not desirable, as one's hat keeps blowing off.
    -- Woody Allen

Reply via email to