MLUG: Re: [MLUG] Batch email
Re: [MLUG] Batch email
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Stephen Montgomery-Smith wrote:
> I have a unix style file full of emails.  I would like to send all of 
> these emails to a single person.  So it is something like this:
> 
> split file into seperate emails;
> foreach $email {
>   system("sendmail EMAIL:PROTECTED < $email");
> }
> 
> While it would be easy enough for me to write a script to do this (as it 
> seems to me that emails are seperated by "\n\nFrom ") I was hoping that 
> there was a ready built tool that would do the job for me, and save me 
> the thinking.
> 

Somehow asking the question on MLUG always makes me search harder for the 
answer.  I found a perl module to help me:


#!/usr/bin/perl

use Email::Folder::Mbox;
my $box = Email::Folder::Mbox->new('mail-file');
while ( my $mail = $box->next_message ) {
    open(SEND,"| sendmail EMAIL:PROTECTED");
    print SEND $mail;
    close(SEND);
}
_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members