Mailing list error recovery

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
elmonty
Forum Newbie
Posts: 13
Joined: Tue Jan 20, 2004 9:52 am

Mailing list error recovery

Post by elmonty »

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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

store the "sent" information in the database where it attaches to the user list and your data. After each email is sent, insert a row into the table saying it was sent. This same table can keep records of bounces too..
User avatar
elmonty
Forum Newbie
Posts: 13
Joined: Tue Jan 20, 2004 9:52 am

Post by elmonty »

The only problem I can find with this idea is that if the database is restored for any reason, the emails will be resent.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

that's more a problem with your server's database core, than with the information needed to keep everyone up to date..

If you require integrity protection of the data then you should have dedicated hosting.. This can happen if the file system is corrupted as well.. the only fail safe systems are massively redundant and distributed.. and even then, there's a slight chance of total failure.
Post Reply