Email limit, will if(mail()) say sent or failed?


I am creating a script that will go through a database of my members email addresses.

The issue I am having is there are more than 500 (which is my limit).

I would like to TEST to see what happens if the 500 email limit is passed so if the email failed, it will try again after an hour. PROBLEM is i do not want to overload the server.

The following code basically says if the email is sent, update record in database to “sent”. If failed, will update record to “failed”.

if(mail($temp_sql->email, “$subject”, $body, $headers)){
mysql_query(“UPDATE newsletter_temp SET request_status = ‘sent’ WHERE tempid = '”.$temp_sql->tempid."’");
mysql_query(“UPDATE newsletter_temp SET request_status = ‘failed’ WHERE tempid = '”.$temp_sql->tempid."’");

Do you know if when gone over the limit, it will still go through and go to ‘sent’ or will it stop and say ‘failed’?

Thank you.

So I managed to find out by an extreemly helpful dreamhost support guy. He said

“…it always shows success, the only way to know that you’ve hit the limit is to look in the Maildir/new directory for new emails, that’s where the bounces would go”

If failed it will show "Recipient address rejected: Policy Rejection- --SENDER_QUOTA_REJECTION–; ".

Does anyone know if there are any scripts that will check each file and if failed mark it ‘failed’ in the database to get it resent?

I would create a separate script on a cron job that checks for any new file into ~/Maildir/new, parse each file, verify that string (SENDER_QUOTA_REJECTION), update your table and finally and remove the file.

Probably you can stop sending e-mails if a rejection is detected for an hour…