Reply
mailing list and cron
Old 08-26-2009, 04:44 AM mailing list and cron
Experienced Talker

Posts: 45
Trades: 0
now i want to make a mailing list .. i want to send a mail up to 2000 user. but the server only allow sending 200 mail at once so i want to make a cron job that make the following task.
1- send mail to 200 user
2- i have a database that have a filed name e-mail that contains mail address and
flags field that contains zero or one
zero -> not sent yet
one -> e-mail sent

3- change the flag in the database from zero to one

4- after an hour the cron will run again and send the mail to the fields of database that have the flag zero.. and i will make the cron run until there is no flags zero so that all mails are sent..

my problem is that i dont know how to work with cron job from PHP i want to know how to run cron Job from php??

NOTE THAT: when the user press send button it will create the cron job for sending the 2000 mail and run every hour to send 200 mail per time ..

can any one help me plz
john_zakaria is online now
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 08-26-2009, 03:28 PM Re: mailing list and cron
Junior Talker

Posts: 1
Trades: 0
use the php sleep() function to slow down the script. something like sleep(30) should keep you under 200 emails an hour.

I run cron from cpanel. I set it up to run once a day.
saepl is offline
Reply With Quote
View Public Profile
 
Old 08-26-2009, 03:56 PM Re: mailing list and cron
NullPointer's Avatar
Will Code for Food

Latest Blog Post:
Easy PHP Search with Opera
Posts: 1,070
Name: Matt
Location: Irvine, CA
Trades: 0
Using sleep is a bad idea, assuming you are on a shared hosting plan. Sleep halts execution, but the script will still be running for the duration. Use cron.

Cron is not a part of PHP. Technically you can create a crontab by using the exec command, but as saepl said, you would normally set it up through cpanel.
__________________
Tinsology | How to Post Code | EverythingDev
NullPointer is online now
Reply With Quote
View Public Profile
 
Reply     « Reply to mailing list and cron
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.12782 seconds with 13 queries