Site Configuration Queries

Simon Huggins huggie at earth.li
Mon May 19 16:34:22 CEST 2003


'ello bogofilter

On Mon, May 19, 2003 at 10:30:18AM -0400, David Relson wrote:
> At 10:15 AM 5/19/03, Simon Huggins wrote:
> >On Mon, May 19, 2003 at 01:55:15PM +0100, Peter Bishop wrote:
> >> On 19 May 2003 at 7:08, David Relson wrote:
> >> > I think you've got it right - an option too far :-)
> >> > I don't think you'll need to do this very often, so speed is not of the
> >> > essence.  Sounds like an opportunity for a perl script.
> >> I think you are right.
> >> Anybody know if there is a suitable perl script handy?
> >Er, isn't this like the script I wrote already?
> >cf 20030506145020.GH20245 at paranoidfreak.co.uk on this list.
> I neglected to do that.  Can you post it to the list again so I don't
> have to search for it?  Be sure to pick a good name for the script and
> include a few comment lines with purpose and usage info.  I'll add it
> to cvs right away.

Not sure if grabmessages is a _good_ name but the script already had
comments etc before.

I've attached it here.

-- 
Simon Huggins  \ '<blitz> huggie: je sais je suis nulle...mais je suis
                \ très tetue alors ça compense :)' #parinux
http://www.earth.li/~huggie/                                htag.pl 0.0.22
-------------- next part --------------
#!/usr/bin/perl -w

=head1 NAME

grabmessages - splits out message/rfc822 parts from a MIME message

=head1 SYNOPSIS

Usage:
    grabmessages <message

=head1 DESCRIPTION

Trivial script to print out all message/rfc822 parts of a MIME message.

Originally from an idea on the bogofilter mailing list as one way to allow
people to easily submit things to the spamlist without having their own
addresses added when forwarding spam to an account.  In such a case messages
should be piped to this before being piped to bogofilter -s

=head1 AUTHOR

Simon Huggins <huggie at earth.li>

=cut


# Copyright(C) Simon Huggins 2003 <huggie at earth.li>
# 
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc., 59
# Temple Place, Suite 330, Boston, MA 02111-1307  USA


# Yes, it is silly having the license boilerplate take up more space than
# the code but it does remove all doubt.

use strict;
use MIME::Parser;

my $parser = new MIME::Parser;
$parser->extract_nested_messages(0);
my $entity = $parser->parse(\*STDIN);

foreach my $subent ($entity->parts) {
	if ($subent->effective_type eq "message/rfc822") {
		$subent->print(\*STDOUT);
	}
}



More information about the Bogofilter mailing list