Help: Schedule email to be sent at regular intervals

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Help: Schedule email to be sent at regular intervals
mjhufford
CZ Active Member
 Codezwiz Site Donator
mjhufford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: IT Industry
Age: 47
Gender: Male
Fav. Sports Team: Da Bears.
Website:
Status: Offline
Joined: Jul 01, 2004
0.04 posts per day
Posts: 288
Points: 15,094
  MSN Messenger 
Hey guys,

I'm trying to rig up an automatic newsletter that queries MySQL for some stuff and sends a formatted email on a weekly basis. Does anyone know how to set this up so that it sends automatically? I can do the whole emailer and SQL stuff, but not sure how to get it to run at regular intervals.

Running Windows 2003 Server Standard, IIS 6.0.




_________________
"The pursuit of easy things makes men weak."
-David O. McKay
Back to top Reply with quote
#2   re: Help: Schedule email to be sent at regular intervals
mjhufford
CZ Active Member
 Codezwiz Site Donator
mjhufford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: IT Industry
Age: 47
Gender: Male
Fav. Sports Team: Da Bears.
Website:
Status: Offline
Joined: Jul 01, 2004
0.04 posts per day
Posts: 288
Points: 15,094
  MSN Messenger 
Okay, like clock work, eh?

Here's what I've decided. Let me know if you think this will work. I'm going to create a table called `prefix_timed_newsletter` and I'll have an identifier, a field called SENT (yes/no) and a field called SEND DATE. It's basically going to store 1 row of data.

Then I'll create a php function that selects the rows from that table where SEND DATE is equal to today's date and SENT is equal to NO. I'll do a numrows count on it and when numrows is greater than 0, I'll send out the email and update the `prefix_timed_newsletter` with a new SEND DATE and reset the SENT field to NO.

Then I'll just have to include this file in another module that gets hit at least once a day so it gets ran....will that work?




_________________
"The pursuit of easy things makes men weak."
-David O. McKay
Back to top Reply with quote
#3   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Sounds like it should work. Why not just set a cron job?




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#4   re: Help: Schedule email to be sent at regular intervals
mjhufford
CZ Active Member
 Codezwiz Site Donator
mjhufford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: IT Industry
Age: 47
Gender: Male
Fav. Sports Team: Da Bears.
Website:
Status: Offline
Joined: Jul 01, 2004
0.04 posts per day
Posts: 288
Points: 15,094
  MSN Messenger 
It's a Windows 2003 box. I've got a similar mod working right now, but I have to initiate on the admin side (Send Newsletter button).




_________________
"The pursuit of easy things makes men weak."
-David O. McKay
Back to top Reply with quote
#5   
mjhufford
CZ Active Member
 Codezwiz Site Donator
mjhufford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: IT Industry
Age: 47
Gender: Male
Fav. Sports Team: Da Bears.
Website:
Status: Offline
Joined: Jul 01, 2004
0.04 posts per day
Posts: 288
Points: 15,094
  MSN Messenger 
Thanks Telli, you got me thinking. I created a scheduled task to open my browser and call the file.




_________________
"The pursuit of easy things makes men weak."
-David O. McKay
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum