Scott Phelps wrote:
> An earlier test showed that with Net::SMTP delivering 5
> messages took about 4 seconds. I'm sure this is caused by
> the overhead of opening a new connection for each message.
Well, don't do that, then.
$smtp = Net::SMTP->new('mailhost');
$smtp->mail('[EMAIL PROTECTED]');
foreach $address (@biglist) {
$smtp->to($address);
}
$smtp->data;
$smtp->datasend("From: me\@example.com\n");
# etc
$smtp->dataend
(Error checking left as an exercise to the reader.)
If you have a smarthost, then open the connection just once, and spew lots
of recipients at it with multiple ->to commands. If you mail direct-to-MX,
you can use this if many recipients share a common mail host (maybe
hotmail.com or aol.com). Of course, this only works if the contents of the
message (including RFC822 headers) are the same for each recipient, so you'd
need a new data loop for each mailing list. But even so, you only have to
open the connection to the mailserver once; after the dataend, start over
with mail, to, and data/datasend for the next mailing list.
Cheers,
Philip
--
Philip Newton <[EMAIL PROTECTED]>
All opinions are my own, not my employer's.
If you're not part of the solution, you're part of the precipitate.
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web