Skip to main content
Participating Frequently
August 2, 2012
Question

How can I put a timed pause between CFMAIL sendouts?

  • August 2, 2012
  • 2 replies
  • 1157 views

A preface, this is not marketing e-mailing I'm discussing, it's already opted-in government notifications requested by the customers.

This is driving me absolutely crazy.  I've got a working SQL query that pulls a number or records (e-mail addresses), then sends out a series of mailings in batches (still working on that part).

What I'm stuck on is how in the world can I pause the CFMAIL processings between batches?  For example, I want to send 500 e-mails, pause for 10 minutes, send the next 500, etc.

CFTHREAD looks kinda like what I might need but I'm not sure.

We're afraid of sending all at once (probably no more than 5,000 to 10,000 total) in fear of being blacklisted.  Usually this app will only send 100 to 500 at a time.

Thanks in advance for any help you guys can give!

This is for CF8, incidentally.

T

This topic has been closed for replies.

2 replies

Participant
August 3, 2012

I've developed a mailing application like this for our own (used for sending up to 100k emails per job so far without a problem) and my solution was this (simplified):

1) set-up a CFusion cronjob that runs every X minutes and executes the following

2) select all records/email-addresses within the sql query (no maxrows parameter)

3) cfloop over this query result-set with startrow and endrow parameter to select just the desired number of addresses

4) stored endrow value in database and used this one as startrow param for the next run/loop, X minutes later... and so on

I do not think that using cfsleep is wise, as such mailingjobs could potientially run for hours if not days, and you don't want to let scripts run this long.

First they occupy one of the precious "max parallel cf threads" slots on your server and second you could potentially loose all progress of this task if your server ever restarts while this script is running.

Inspiring
August 2, 2012

cfsleep

Participating Frequently
August 2, 2012

I can't find almost anything at all on this tag, is this a custom tag?

Inspiring
August 2, 2012

I think CFSLEEP was an old custom tag.  Just use the sleep() function.

-reed