View Full Version : email system

08-13-2012, 03:15 AM
I need some help with coding with mail().
I have an sql database with 3000 records, emails of users that have signed up for my newsletter.
Due to restrictions imposed by my host provider, I cannot send one message to more than 30 records, thus I have a major problem with managing my newsletter.
So, what I need help with is a script that divides the 3000 records by 30, than send 100 messages delayed by 30 seconds let's say.
Help would be highly appreciated.
Thank you.

08-13-2012, 01:17 PM
Find out the "exact" specifications of your host's email rules.
Some limit not only by the hour, but by the day.

Tell us for sure what the specs are. Otherwise use a paid newsletter host
other than your webhost. That actually might be the best way, but it will
cost you money.

08-13-2012, 03:15 PM
MailChimp give you a free allowance of 2000 subscribers with 12,000 emails a month so if you're hitting limits it's the way to go.

Otherwise if you're limited by rate and are not capped, you'd be best setting up a cron job which fires every couple of minutes and takes 30 records at a time and sends off emails.

08-13-2012, 05:28 PM
You can add a new column to your MySQL table called 'timesent INT(12)'

You query the table looking for the first 30 of them that have a
timestamp out of the range you're looking for. After sending those 30,
you update those 'timesent' fields to the current timestamp: time()

When you query again, those 30 won't be in your query results.

Repeat until no more results are found.