Re: Creating Aliases from sent messages?

2002-10-07 Thread darren chamberlain

* John P Verel [EMAIL PROTECTED] [2002-10-06 19:31]:
 This worked just as promised!  Cleaning out the Message-IDs was no big
 deal.  Thanks a million Darren!  Forgive my delay in responding, but I
 just found time to do this today.

Nice.  I banged it out pretty quickly.

 I piped the output to a file.  The only thing I had to then do was to
 prepend the word 'alias' and a dummy alias (I used numbers) before each
 address, so as to make the list work with mutt.  (I did this via a
 spreadsheet)  I am a COMPLETE Perl novice, so please forgive this
 question, but how could the script be modified to automate this
 prepending?

Change the last line (the print line) to read:

  print map alias $_\n, sort keys %addrs;

Which will give you a list like:

  alias [EMAIL PROTECTED]
  alias [EMAIL PROTECTED]

(darren)

-- 
Pohl's law: Nothing is so good that somebody, somewhere, will not hate
it.



Re: Creating Aliases from sent messages?

2002-10-07 Thread John P Verel


On 10/07/02 08:40 -0400, darren chamberlain wrote:
 
 Change the last line (the print line) to read:
 
   print map alias $_\n, sort keys %addrs;
 
 Which will give you a list like:
 
   alias [EMAIL PROTECTED]
   alias [EMAIL PROTECTED]
Many thanks!

John



Re: Creating Aliases from sent messages?

2002-10-06 Thread John P Verel


On 10/01/02 14:39 -0400, darren chamberlain wrote:
 * 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.

This worked just as promised!  Cleaning out the Message-IDs was no big
deal.  Thanks a million Darren!  Forgive my delay in responding, but I
just found time to do this today.  Also, File::Slurp and Email::Find had
to be installed.

I piped the output to a file.  The only thing I had to then do was to
prepend the word 'alias' and a dummy alias (I used numbers) before each
address, so as to make the list work with mutt.  (I did this via a
spreadsheet)  I am a COMPLETE Perl novice, so please forgive this
question, but how could the script be modified to automate this
prepending?

John



Re: Creating Aliases from sent messages?

2002-10-01 Thread Michael Tatge

John P Verel ([EMAIL PROTECTED]) muttered:
 I've searched the manual high and low on this and come up blank.  I want
 to create a file of aliases based upon messages I've sent, rather than
 receive.  They are all in one folder for ease of access.  While creating
 an alias from a received message is a snap, it appears that, short of
 typing in long hand, there's no quick way to do this.

Why don't you run a little shell or perl script against that folder?

HTH,

Michael
-- 
Even more amazing was the realization that God has Internet access.  I
wonder if He has a full newsfeed?
(By Matt Welsh)

PGP-Key: http://www-stud.ims.uni-stuttgart.de/~tatgeml/public.key



Re: Creating Aliases from sent messages?

2002-10-01 Thread darren chamberlain

* 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



Creating Aliases from sent messages?

2002-09-30 Thread John P Verel

I've searched the manual high and low on this and come up blank.  I want
to create a file of aliases based upon messages I've sent, rather than
receive.  They are all in one folder for ease of access.  While creating
an alias from a received message is a snap, it appears that, short of
typing in long hand, there's no quick way to do this.

Perhaps there's a macro around that will do this?

TIA.

John