On Wed, Nov 07, 2001 at 09:29:40AM -0600, Jay Kline wrote: > At the company I work for, we have a "trap all" email account, which collects most every piece of mail sent here. On an average day, it recieves 15 to 20 thousand emails a day, and is stored in a standard POP account. Because a large number of these messages are server generated, all that is important is the sender email address and the subject line (for most anyway) Is there some way I can automate a process that goes through these emails, and creates a text file containing the email address and the subject line, without having to download the whole message? (in other words, one text file on my machine that would get very large very quickly- one line per email/subject) Some filtering capibilities would be nice, but not required. I can do that later with grep if need be. Yes, TMTOWTDI obviously, but this little piece of code gets me something like this: From: First Last <first.last at company.tld> Subject: whatever #!/usr/bin/perl -w use strict; use Net::POP3; use MIME::Head; my ($user, $pass, $host) = qw(username password localhost); my $pop = Net::POP3->new($host); $pop->user($user); my $msgs = $pop->pass($pass); unless ($msgs) { print "Couldn't connect to $host with $user\n"; $pop->quit(); exit 1; } for (my $i = 1; $i <= $msgs; $i++) { my $top = $pop->top($i, 0); my $head = MIME::Head->new; $head->header($top); # [1] print "From: ", $head->get('From'); print "Subject: ", $head->get('Subject'); } $pop->quit(); __END__ [1]: If you want filtering capabilities you put them in here. If Net::POP3 and/or MIME::Head aren't installed on your machine: perl -MCPAN -e'install Net::POP3' perl -MCPAN -e'install MIME::Head' -- Thomas Eibner <http://thomas.eibner.dk/> DnsZone <http://dnszone.org/> mod_pointer <http://stderr.net/mod_pointer>