Building an email Application w/ cron jobs and have a few question
Posted 23 June 2006 - 11:24 PM
The application I decided to creating is a newsletter/email campaign mailing system. I have it set up so that the person will upload the mailing list(s) then upload the selected email(s) and then there is another table (campaign) that tracks which email will be mailed out to what list.
My thought is to have a cron job script run every 15 minutes and check if there are any "pending" campaigns to send out. If there is a pending campaign the campaign's status will be set to "in progress" and the script will start to send out the emails. I plan on using the sleep() function in order to send out 6 emails a minute. When the script is done it will set the campaign status to "sent" and send a notification email stating the the email has been sent.
1) Do I need to use the set_time_limit(0); function on this cron script?
1a) Will it timeout without it even though the script is not running through apache?
2) Will I notice any drain on the server with this type of setup?
3) If the server was to reboot in the middle of the script being executed will the process stop and not send anymore emails?
3a) If this is the case what would be the best way to "resume" where the script left off? I would rather not add anymore columns to the tables.
4) Does anyone see any problems with my "process"
5) if the cron script is in the proccess of running and 15 minutes pass and it comes time to run the script again, will it stop the current process and start over? or does it start a new process in tandem with the frist?
Currently there is 327 recipients in the database for the first newsletter that I plan to send out.
Each email is going to be customized with the recipients name and will have an opt-out link at the bottom.
Thanks in advance,
Posted 24 June 2006 - 12:31 AM
You can use the PEAR Mail package at http://pear.php.net/package/Mail
or PHPMailer at http://phpmailer.sourceforge.net/
if you are on a shared hosting plan, check with your hosting company on mailing limitation.
Posted 24 June 2006 - 01:13 AM
I will look into PEAR and I have some PHPMailer experiance, can these be used with a cron job? I believe my question are still valid with these.
Posted 24 June 2006 - 12:19 PM
I will look into PEAR and I have some PHPMailer experiance, can these be used with a cron job? [/quote]
Not sure how familar you are with running CronJobs but they they basically just execute a page ever XX minutes you set. Cronjobs run whatever you tell it to run, so you can execute any links/scripts with it.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users