If you use Data::Dumper on your MIME::Lite object you will see that it is just the text string of the MIME formatted email.
So all you need to do to send the same message to a large number of recipients is this:
$msg = MIME::Lite->new( From =>'me@myhost.com', To =>'recipient@yourhost.com', Subject =>'Helloooooo, nurse!', Type =>'image/gif', Encoding =>'base64', Path =>'hellonurse.gif' ); # add multipart(s) to $msg in the usual way for my $recipient (@recipients) { $msg =~ s/To: (.*)/To: $recipient/; $msg->send; }
All we are doing is rewriting the To: foo@bar.com part of the header which has the desired effect. You could also just do a Cc like:
my $cc = join ', ', @recipients; $msg = MIME::Lite->new( From =>'me@myhost.com', To =>'you@yourhost.com', Cc =>$cc, Subject =>'Helloooooo, nurse!', Type =>'image/gif', Encoding =>'base64', Path =>'hellonurse.gif' ); $msg->send;
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: 'pre-MIMEing' an attachment?
by tachyon
in thread 'pre-MIMEing' an attachment?
by ebodine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |