Package: libmail-mboxparser-perl Version: 0.55-1 It would be nice if Mail::MboxParser would be able to parse both types of From: addresses:
From: "foo bar" <[EMAIL PROTECTED]> and From: [EMAIL PROTECTED] (foo bar) Unfortunately the latter is not understood. Please find a test program attached. Regards, Joey -- Testing? What's that? If it compiles, it is good, if it boots up, it is perfect. Please always Cc to me when replying to me on the lists.
>From [EMAIL PROTECTED] Sat Aug 11 16:25:07 2007 Return-Path: <real-joey> Received: by carelia.infodrom.org via send-mail from stdin id <[EMAIL PROTECTED]> (Debian Smail3.2.0.115) Sat, 11 Aug 2007 16:25:07 +0200 (CEST) Message-Id: <[EMAIL PROTECTED]> Date: Sat, 11 Aug 2007 16:25:07 +0200 (CEST) From: [EMAIL PROTECTED] (Joey Schulze) To: [EMAIL PROTECTED] Subject: ud-roleadd Reply-To: [EMAIL PROTECTED] (Martin Schulze) Content-Length: 1430 Noe
#! /usr/bin/perl use Mail::MboxParser; use Data::Dumper; my $fname = "testmail"; my $mbox = Mail::MboxParser->new($fname, decode => 'ALL', oldparser => 0, uudecode => 1); my $mail = $mbox->next_message(); my $rname = $mail->from->{name}; my $email = $mail->from->{email}; my $subject = $mail->header->{subject}; if ($email =~ /\s/) { print "Need to convert the mail address\n"; if ($email =~ /([EMAIL PROTECTED])\s+\((.*)\)/) { $email = $1; $rname = $2; } else { $email = (split(/\s+/, $email))[0]; } } $email = lc($email); printf "rname: %s\n", $rname; printf "email: %s\n", $email; printf "subject: %s\n", $subject; printf "%s\n", Dumper $mail->from;