Welcome Guest, Not a member yet? Register   Sign In
Problem with timing to send mails, sleep of 15 minutes
#1

[eluser]Rubiz'[/eluser]
Hello!!

Well, I'm with a problem, more logical than freak...

I built a logic script for sending mail marketings, but my host cant send more than 50 once, it must be:

- send 50...
- wait 15 minutes
- send more 50...
- wait more 15 minutes..

This is relatively ease to do, I made it with the sleep() PHP function, to make the waiting 15 min. but I'm getting this error: MySQL server has gone away.

I would like to know what s#$%t is that, and how I could solv this problem... anyone has any idea?

Thanx...
#2

[eluser]gon[/eluser]
Keeping a PHP script running for hours is not a good idea, from my experience.
I would insert email recipients in a DB table,
then would call a PHP script every 15 minutes using CRON. The script would send 50 emails from the DB, erasing them, and exit.
If there is nothing to send just exit and you're done.
#3

[eluser]Rubiz'[/eluser]
I have made this question already and people told me about that, acttualy I really don't know what is "CRON"... what is it?
#4

[eluser]gon[/eluser]
Cron is a program that executes periodic tasks on UNIX-like systems, Linux, BSD etc.
If you use Windows, there is also a system for this, although I found it to be quite buggy under Windows Server 2003 some time ago. Google for that.

Anyway, the procedure is going to be the same. Learn how to use the method available in your system, and prepare a codeigniter script that will be executed as a cron task, as described here.
#5

[eluser]Rubiz'[/eluser]
This looks very advanced to me Gon, I'll try make something with refresh or prototype, thanx for your help! Smile




Theme © iAndrew 2016 - Forum software by © MyBB