Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old January 23rd, 2001, 11:50 PM
rtoews rtoews is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Posts: 54 rtoews User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
The requirement is to be able to send a personalized email to each of several thousand recipients, in either HTML or plain text format.

Currently, the list of addresses is generated by querying a MySQL table using PHP. This list is presented (one address per line) in a textarea form field on a "preview" page and can be modified before actually sending out the emails.

When the preview page is submitted, a confirmation page comes up, and the emails must actually be sent.

Part of the difficulty I'm having is this: while I can use system("./email.cgi&"); to launch a call to the email.cgi script so that it runs in the background while the confirmation page sent.cgi is displayed, the browser doesn't indicate that the page is "completed" until email.cgi finishes. (E.g., in Explorer, the "processing" icon in the upper right continues to be in motion during this time.)

Another part of the difficulty is that of passing the long list of email addresses to the email.cgi script. When I'm just testing, I use a loop to send a certain quantity of emails to an address used for test purposes; however, in reality, I need to pass the actual list to the script. I'm guessing that a list of nearly 10,000 email addresses is too long to pass in an argument list. (I know it would be too long for the environment QUERY_STRING.) Is there a preferred way of conveying a large quantity of data in such a situation? Do I have to save it to a file first, or is there a more direct way?


From a slightly different angle:

Something else I have tried is having the preview page send the form data directly to email.cgi and having email.cgi launch the confirmation page using a system() call. Since the preview page calls the cgi script using the POST method, the amount of data being passed isn't a problem. The problem is that, while the confirmation page does get displayed, the browser doesn't indicate that it's finished loading until the emails have been processed. This might be tolerable for a few emails, but I don't think it's going to work for a large quantity.


Thanks for any suggestions,

Rick

Reply With Quote
  #2  
Old January 24th, 2001, 08:24 AM
mickalo's Avatar
mickalo mickalo is offline
Ole` Timer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: N.W. Iowa
Posts: 469 mickalo User rank is Private First Class (20 - 50 Reputation Level)mickalo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 5 h 19 sec
Reputation Power: 8
Send a message via AIM to mickalo Send a message via MSN to mickalo
Here is a simplified example of using the fork() function as mentioned in the MySQL forum.

Code:
$pid = fork();
print "Content-type: text/html nn fork failed: $!" unless defined $pid;
if ($pid) {
    # parent process
    # Display confirmation
	exit;
}
else 
{
     # child process
     close (STDOUT);
# Do the mass emailing here

 }


Now when the parent process is executed, displaying the confirmation page, the child process is then spawned and executed. So the mass mailing is done in the "background" without delaying the parent process.

Mickalo

__________________

Thunder Rain Internet Publishing

Custom Programming & Database development
Providing Personal/Business
Internet Solutions that work!

Reply With Quote
  #3  
Old January 24th, 2001, 10:46 AM
rtoews rtoews is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Posts: 54 rtoews User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Thanks for the input. I've never done anything with a fork before, and the code looks a little strange to me: the condition looks as though _either_ the confirmation will be displayed _or_ the emails will be sent. I'll try it out and see how it works.

--Rick

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > email question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway