Best way to send message to all subscribers

liunx

Guest
I'm developing a mailing list script and using the following script to send the same message to all subscribers, actually it's working fine but I feel it's taking much time.

My questions are:
1. Is my way correct?
2. Is their another way, which will be better and fast?



open (FILE,"$mailfile")|| die "Can't open $mailfile!";
if ($filelock ='y' ){flock(FILE,2);}
while (<FILE>){
($address,$name)= split /\|/;

open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";
print MAIL "From: $listname<$listemail>\n";
print MAIL "To: $address\n";
print MAIL "Subject: $title \n\n";
print MAIL "HI : $name\n";
print MAIL "--------------------------------------\n";
print MAIL "$msge\n\n";
print MAIL "Regards: $administrator\n\n";
print MAIL "$date\n";
print MAIL "$time\n\n";
print MAIL "________________________________________________________________";
print MAIL "http://www.domain.com\n";
print MAIL "________________________________________________________________";
close (MAIL);
} #while end
close(FILE);
 
Back
Top