CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Send Email to everyone in Data File?

 



CuzDesign
Deleted

Jan 8, 2001, 10:14 PM

Post #1 of 2 (210 views)
Send Email to everyone in Data File? Can't Post

Hello,
I have a program where emails will be sent out to everyone in a data file.
I have it figured out to be able to send to everyone the only problem I see is that if the data file was large and had alot of emails it would take along time to send all the emails.

My Question is How can I change the following code so that it sends them faster, at the same time without the delay for the person sending.


Code
open (DATA,"<$usersdata") or die "Couldn't open users.dat $!\n"; 
while (<DATA> ){

# If system supports file locking then lock file
if ($LOCK_EX){
flock(DATA, $LOCK_EX);
}
chomp;
my @list = split(/:/,$_);
my $to = $list[0];
my $name = $list[3];
my $lastname = $list[4];
# Send email
open(MAIL,"|$mailprog -t");
print MAIL "To: $name $lastname <$to>\n";
print MAIL "From: $companyname <$adminemail>\n";
print MAIL "Subject: $subject\n\n";
print MAIL $body;
close MAIL;
}
close (DATA);

Any help would be greatly appreciated.

Thanks in advance.

Ray




randor
User

Jan 11, 2001, 5:27 AM

Post #2 of 2 (195 views)
Re: Send Email to everyone in Data File? [In reply to] Can't Post

Well Ray,

in my limited knowledge of perl i do not know of a way to not have to wait if you are sending to alot of recipients, BUT, if the circumstances are right, you may want to look into possibly using crontabs to do this for you, then you would not have to wait, but that is only if the circumstances fit your needs.. to look at crontabs try this:
http://www.bluehill.com/faq/crontab.htm



 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives