Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Simon (89)

AOL IM: lathosjp (Add Buddy, Send Message)

Busy Man.

Journal of Simon (89)

Monday June 10, 2002
05:50 AM


[ #5532 ]
A mailbox scanner:

use strict;
use Mail::Util qw( read_mbox );
use Mail::Internet;
use Mail::Address;
use Time::Duration;
use Date::Manip qw( ParseDate UnixDate );
for (map { Mail::Internet->new($_) } read_mbox("/home/simon/mail/pending")) {
    my $when = $_->get("Date");
    my $who = (Mail::Address->parse($_->get("From")))[0];
    $when = time - UnixDate(ParseDate($when), "%s");
    print "Mail received ",ago($when), " from ",$who->phrase,"\n";
    print "Subject: ", $_->get("Subject"),"\n";

Fourteen lines, six Perl modules, to summarise a mailbox. What was I thinking?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.