Emailing Per Hour

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Mr Tech
Forum Contributor
Posts: 424
Joined: Tue Aug 10, 2004 3:08 am

Emailing Per Hour

Post by Mr Tech »

I have a script that sends out newsletters using the PHPMail class and MySQL. My host only allows me to send out 100 emails per hour...

How would I make the script so that if it has sent 100 messages within the first hour, it waits till the hour is over and then continues for another hour sending out anoi\ther 100 messages. When 100 messages are again sent within the hour it waits until the next hour to continue and so on...

Any ideas?

Thanks

Ben
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

set up a cron job for each hour then have it check to see if a newsletter was sent to the address if not then send
User avatar
Mr Tech
Forum Contributor
Posts: 424
Joined: Tue Aug 10, 2004 3:08 am

Post by Mr Tech »

So I would need to put limit 100 in the mysql query?

How would be the best way to store whether an email has been sent to a certain email address?
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

like so (im pretty sure)

email_database
id int(12)
email varchar(255)
sent enum('No', 'Yes')

SELECT email FROM email_database WHERE sent='No' LIMIT 0, 100
User avatar
Mr Tech
Forum Contributor
Posts: 424
Joined: Tue Aug 10, 2004 3:08 am

Post by Mr Tech »

Ok thanks I'll give it a go.
Post Reply