Need a little help on an email list script.
I want to store email messages in a database, and then loop through any of those messages that haven't been sent to every single member listed in my members list. I'm on 1&1 and they only permit 55 emails sent every 5 minutes. So I have to do this with a Cron Job.
How would I make it so the script pulls one email message at a time, sends the email to each member in the members database, then marks the email as sent in the message database, and resets the "sent" column in the members database back to 0.
Maybe I should include the most recent message id sent for each members row?
Here's my database structure:
| id | name | email | sent |
| 1 | Test | Test@example.com
| 0 |
| id | message | email_sent |
| 1 | Test Message | 0 |
| 2 | Test Message 2 | 0 |
$mailing_list_result=mysqli_query($mailing_list_db, "SELECT `name`, `email`
FROM `mailing_list` WHERE `sent`=0 LIMIT 0, 55");
`mailing_list_mesages` SET `email_sent`=1 WHERE `email_id`=?");
$reset_result=mysqli_query($mailing_list_db, "UPDATE `mailing_list` SET
//Database Pull for Email message