On Mon, 5 Mar 2007, Luis HernĂ¡n Otegui wrote:

OK, Chris, I think I'll go on with you suggestion. I seems simpler, and a
lower load for my busted servers. However, I'm not a Perl Guru myself, so,
mind if you could clarify what did you ment with "In that case, Perl's
Mail::Box::Manager is your friend."

How do I extract the original mail from the forwarded one?

No idea -- I'm not doing things that way myself.  My suggestion was
actually to bounce or resend the FPs and FNs, since it's a lot
simpler.  You can just call sa-learn on the bounced messages
themselves rather than extracting the forwarded messages from the
attachments.

If you decide to have your users forward as an attachment, though,
Mail::Box[::Manager] is a Perl module for doing magic with mailboxes.
You'll probably want to do something like this, assuming you're using
Maildir:

my $mgr = Mail::Box::Manager->new();
my $folder = $mgr->open(folder      => "/path/to/spam/mailbox",
                                                           fix_headers => 1);

foreach my $msg ($folder->messages()) {
                  ....magic with $msg->parts()....
}

If you're not using Maildir, you'll have to figure out what to do from
there.  I know Mail::Box supports MH, Mbox, and who knows what else,
but haven't used those myself.

http://search.cpan.org/~markov/Mail-Box-2.069/lib/Mail/Box-Overview.pod
should get you started.

Chris St. Pierre
Unix Systems Administrator
Nebraska Wesleyan University
----------------------------
Never send mail to [EMAIL PROTECTED]

Reply via email to