Mailing list error recovery
Posted: Tue Feb 01, 2005 4:58 pm
I'm writing my own discussion mailing list in PHP. I need some input on recovery methods in case the process is interrupted.
What I'm doing now is placing incoming messages into a queue directory and then starting my PHP CLI script. This script loops through each file in the queue, reads the message contents, extracts the subscribed email addresses from a SQL database, then uses SMTP to send the message to those addresses.
I'm concerned about what happens if the process is interrupted. How do I keep track of which addresses have already been delivered and which haven't? How do I resume from where it left off?
Should I keep a file with all the addresses for each message? If I did that, I'd have to rewrite the file after each address was sent. That doesn't seem very efficient.
Or I could replicate each message and place a copy of the message for each recipient in another queue folder, then delete them as they are sent. That seems pretty wasteful of space, though, especially if the message is large.
Any other ideas?
What I'm doing now is placing incoming messages into a queue directory and then starting my PHP CLI script. This script loops through each file in the queue, reads the message contents, extracts the subscribed email addresses from a SQL database, then uses SMTP to send the message to those addresses.
I'm concerned about what happens if the process is interrupted. How do I keep track of which addresses have already been delivered and which haven't? How do I resume from where it left off?
Should I keep a file with all the addresses for each message? If I did that, I'd have to rewrite the file after each address was sent. That doesn't seem very efficient.
Or I could replicate each message and place a copy of the message for each recipient in another queue folder, then delete them as they are sent. That seems pretty wasteful of space, though, especially if the message is large.
Any other ideas?