Waiting time between several mail sent

Is there a possibility tu put a waiting time between cfmail sent through a loop.
cfloop query the users
cfmail to user
here , can i put a waiting time ?
/cfloop>

Because, I have mail rejection with this indication
“Too many mail per minute”

Thanks for help.

OS linux debian 10
lucee version : 5.3.3.62
apache 2

I tried to add sleep(3000) between the cfmail s
I am not sure the sleep is for the code continuity or will impact the mail spooler ?
Thanks for advise.

If you are looping a database query you could return a result set max rows of ‘X’ rows, then update a column that those X rows have been sent, then create a scheduled task to run that every 10 minutes or however often that has to fire to be below the sending threshold to send all the mail or run it manually until you’ve sent all mail.

If this is for email marketing, you could use SendGrid’s API as there is no sending threshold.

It is not for marketting.
It is a site for publishing classified ads and notify the members by mail.

Ok, I will think with the schedule task.

So, you think that the sleep function will not do the job ?

Thanks.

The sleep function may work as well. That all depends on how quickly the mail server can send the messages out of the spool.

there is a sendtime attribute, so you could try that, just increment the send time?

is that message coming from your own smtp server or a remote one?

Then, you mean, setting the actual time in the first mail “sendtime” param,
then increment the “sendtime” in the loop with 3 second (for example) for next mails,
I will try this.
Do you think that the sendtime value expected is a full date and time, or could be only a time ?
Thanks.

The documentation says it should be a datetime object. See

This is what we use to send in batches with a sleep delay.

1 Like