I am sure that the page refresh code works, however, I personally try to
avoid doing meta refreshes at all costs.  I prefer to have one batch
that sent all the emails and delayed the proper amount of time between
each batch.

A java thread (which ColdFusion code is converted to) is doing a NOP (no
operation) procedure during a java Sleep command which causes no
inefficiency.  The multiprocessing nature of the CPU handles this
functionality for you and will use those CPU cycles with other requests
during the sleep.

This guarantees that all of the emails will be sent.  

This sleep command will wait for 1 minute between each of the batches.

<cfset createObject('java','java.lang.Thread').sleep(60000)>

You can use the mod function to detect how many emails have been sent.

<!--- sleep 1 min for every 100 emails --->

<cfif currentRow mod 100 eq 0>

   <cfset createObject('java','java.lang.Thread').sleep(60000)>

</cfif>

When you place this code inside you CFOUTPUT query statement it will
send all the email you have in your query and delay for the server to
allow them to go through.  

Thanks,

Ryan Duckworth
Macromedia ColdFusion Certified Professional
Uhlig Communications
10983 Granada Lane
Overland Park, KS 66211
(913) 754-4272

  _____  

From: Matt Robertson [mailto:[EMAIL PROTECTED]
Sent: Monday, August 09, 2004 2:21 PM
To: CF-Talk
Subject: Re: CFMail

The problem I had doing the sleep thing mentioned above is that it
ties up a thread during the whole deal.  My script is a different
operation on every mail run, so you don't blast CF with an attempt to
run a 60,000ms procedure.

As godawfully inefficient as it is, that script you've been pointed to
seems to be a pretty decent solution.  However one thing I have seen
requested frequently is failover recovery (i.e. power failure in the
middle of the run blasts the browser).  You could do that yourself
with a flag field in your mailing db that runs concurrently with each
mail batch.  I'll probably use a client var in the published script to
keep it generic.

Cheers,

--
--Matt Robertson--
MSB Designs, Inc.
mysecretbase.com
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to