PHP Mailer - Error detection

Soldato
Joined
12 Jan 2004
Posts
6,824
Location
Londinium
Hi guys,

I wrote my own custom mailer in PHP that works pretty well. The only thing is the other day I had my first failure and I got the notification email about it. However, I hadnt written in any error detection so I don't know what part of the script caused the problem.

At the moment, the script is run every 15 mins with cron. When it finds an unsent campaign, it updates the database at the beginning to show that the broadcast has begun. It then updates it at the end (after all the mails have been sent) to show it was successfull as well as how many were sent and which addresses it was sent to. If an error occurs, the script bombs out. The next time it runs it detects any failed campaigns and sends me an email to inform me. However, it doesnt include any error information to tell me which emails it did get sent to and how or why it failed.

I thought about updating the database after every mail is sent (as opposed to doing it at the very end), that way I'd know which addresses did get sent - but is this a wise move performance wise?

Any other tips to improve my scripts error handling would be greatly appreciated!
 
Back
Top Bottom