OT: a perl script to split mails
Daniel Gercke
gercke at HNM.DE
Fri Jun 11 16:57:26 IST 2004
Hi all,
some of you are so familiar with perl that i ask my question here,
although it is not directly a mailscanner question.
I train my bayes every day with the false detected hams and spams.
For this i have two accounts to that mails will be forwared (as
attachement) which are false detected.
Here is the problem. The sendermail is not a spammer, so i must split
mails into mail + mail attachements. i have written a little script for
that but for to work i need forward every mail as a single attachement.
has anyone a reason for that which can handle more than one mail attached.
sorry for my english :-)
Daniel Gercke
programmierung . system managements
Ken A schrieb:
> I use this to split large mailboxes into separate files named
> message.0001...
>
> ------- snip -----
>
> #!/usr/bin/perl
> $progname = 'mailsplit';
> $tag = '^From ';
> $n = 1;
> $is_open = 0;
> while( <> )
> {
> if( $_ =~ /$tag/ )
> {
> close( FILE) if $is_open;
> $file = sprintf( "message.%04d", $n);
> open( FILE, ">$file") || die "$progname: $! ($file)\n";
> $is_open = 1;
> $n++;
> }
> print( FILE $_);
> }
> close( FILE) if FILE;
>
> ------ snip ------
>
> The problem that complicates this is that the header "To :" field may
> not be the same as the envelope recipient, and may contain several email
> addresses (meaning you'll have duplicate emails in the trash mbox too).
>
> You'd actually have to grep the log by msgid for the original recipient
> to match these up I think. How tough this is depends on what your idea
> of fun is. :-)
>
> Ken A
> Pacific.Net
>
>
> Christopher Schanzle wrote:
>
>> Jeff A. Earickson wrote:
>>
>>> Gang,
>>>
>>> I screwed up my procmail rules yesterday and had procmail deliver
>>> all of my inbound email into a "trash" mbox file for a while. Ouch.
>>> I then had 1200+ messages that I had to get delivered to their proper
>>> recipients somehow. I googled for some kind of script that would
>>> rip apart an mbox file and resend messages, but found zilch (I did
>>> find a lot of queries for this kind of script though).
>>>
>>>
>>
>> I have used formail, part of the procmail package, with good success in
>> the past.
>>
>> -------------------------- MailScanner list ----------------------
>> To leave, send leave mailscanner to jiscmail at jiscmail.ac.uk
>> Before posting, please see the Most Asked Questions at
>> http://www.mailscanner.biz/maq/ and the archives at
>> http://www.jiscmail.ac.uk/lists/mailscanner.html
>>
>>
>
> -------------------------- MailScanner list ----------------------
> To leave, send leave mailscanner to jiscmail at jiscmail.ac.uk
> Before posting, please see the Most Asked Questions at
> http://www.mailscanner.biz/maq/ and the archives at
> http://www.jiscmail.ac.uk/lists/mailscanner.html
>
>
--
haus neuer medien GmbH . agentur fuer neuen antrieb
.
Tel 03834 8313 0 . Fax 8313 13 . info at hnm.de . www.hnm.de
Wolgaster Strasse 146 (Ollmannsche Villa) . 17489 Greifswald
AG Stralsund HRB 5089 . Geschaeftsfuehrer Daniel Scheibner
.
--
[Diese Nachricht gilt als frei von Viren und gefaehrlichen Dateianhaengen.
Schutz vor Viren und Spam von haus neuer medien. Bei Fragen oder Interesse Kontakt ueber mailscanner at hnm.de oder 03834 83130.]
-------------------------- MailScanner list ----------------------
To leave, send leave mailscanner to jiscmail at jiscmail.ac.uk
Before posting, please see the Most Asked Questions at
http://www.mailscanner.biz/maq/ and the archives at
http://www.jiscmail.ac.uk/lists/mailscanner.html
More information about the MailScanner
mailing list