Hi everyone.
I'm having some problems with my script, hope you guys can help me out!
I have a script that reads in email addresses from a file and for each email
address, it will open up sendmail and pipe data into it. I'm using the
following code fragment to send mail.
open (MAIL, "|/usr/sbin/sendmail -t");
print MAIL "To: $to\n";
print MAIL "From: zhehong\@tm.net.my\n";
print MAIL "Subject: Just a test.\n\n";
print MAIL "Message here\n";
close (MAIL);
My problem is, for some reason, it takes anywhere between 5-10 seconds to
send a mail using sendmail. I have to send out around 30000 emails a day so
my current solution will not work (30000*5=150000 seconds, there're only
87000 seconds in a day =( ).
Will forking another sendmail process solve the problem? If yes, how should
I implement it? If no, what is the next best alternative?
I was thinking of something similiar to this.
foreach $email (@address_list) {
# do some processing here
unless (defined($pid = fork()) {
die "Cannot fork.";
}
unless ($pid) {
open (MAIL, "|/usr/sbin/sendmail -t");
print MAIL "To: $to\n";
print MAIL "From: zhehong\@tm.net.my\n";
print MAIL "Subject: Just a test.\n\n";
print MAIL "Message here\n";
close (MAIL);
exit;
}
#do somemore processing here
}
Thanks for reading.
Zhe
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]