Let me know if you can figure out the logic behind the custom script you want, Brett. I'm racking my brain with the next update..
I've been busy over the last 5 days or so working on LM.
Here's the latest [
view Changes.txt] along with some notes:
- added storage of dailymail 'last ran' time. dailymail will not run via cron task until 23h55m from last ran.
This addition protects against runaway cron tasks that seem to 'refresh' the URL after a certain time. The last execution time can optionally be updated (though it might/probably will cause ListMail to skip your next dailymail!) when running dailymail manually.
Note: This feature might be detrimental when testing whether or not the cron task is configured correctly. For example, when testing 'wget' alternatives I like to run the cron task every minute. Perhaps a simple variable option, ie "&test=1" added to the cron command could generate a success message to allow for this. That, or an option could be placed within ListMail somewhere to put dailymail into and out of 'test' mode. This would need to be explained in the installation documentation. I suppose each method is equally useful. The first method has the added benefit that I don't need to use up any space in the ListMail interface on the Config page. While I could place the option on the manual Dailymail page it might be confusing for installation.
What do you think about my assumption of 23h55m?
- added queue protections to prevent duplicate emails when refreshing the send page or when resuming queues too soon
This is a really nice improvement that prevents errors (duplicate emails, mostly) and makes ListMail more user-friendly.
When you refresh a standard send page it says "This message has already been sent, did you hit refresh?". This is achieved by creating a "formid" on each "Send Email" page and storing it in the queue protect table (for 3 days). I took the caching off of that page so a new formid is always generated.
When you hit Resume on a completed mailing, it says "This mailing has been completed". This is done by storing the status of a queue which indicates it has completed (3 days).
When a mailing starts, a new entry is made in the new 'queue protect' table with the flag indicating the message is "queueing". That is, the users haven't been entered into the
ListMail queue table yet, which is done before sending to the server. "Queueing" messages may not be resumed (a message will say "This message is in the process of queueing"), thereby preventing mailing if the ListMail queueing process is interrupted before it finishes.
As any mailing progresses it updates the 'queue protect' table with the current time every 20 seconds. You may not resume a queue that has responded in less than 60 seconds.
If you try to resume a message that has responded within 60 seconds, a page is shown. The page tells you how many seconds ago the queue last responded and provides another Resume button so you can try again. When the last response time is less than or equal to 22 seconds the page states that the queue 'appears to be running normally'. When the last response time is greater than 22 seconds the page states "seems to be failing". Once the 1 minute mark is reached you may resume a failed mailing.
I think this improvement will take a LOT of the headaches out of mail sending. It will also cut down on support requests as the sending process can now be ruled out in case of duplicates, etc.
Do you think I need options for how often the 'queue protect' table is updated and how long after a queue has stopped responding to allow a resume? Personally, I think 20 seconds and 1 minute is a perfect balance of speed and stability.
- added the ability to move or add followups into the middle of a live sequence, inserting them
- added 'smart' followup and user seq # renumbering when adding, inserting, and deleting followups
A very useful feature (inserting) and some cosmetic improvements. After spending an entire night on it I started over, sitting down with a pen and some paper to rewrite the logic. The result is safer, more straightforward and easy-to-test code. I have tested this quite thoroughly and am confident there will be no problems with it.
---
That's it for today. I believe the only other major feature I will implement before the update is an auto resume script. Here's what I envision:
Scheduled script, ie. "resume.php" runs every 5-15 minutes. The script checks the 'queue protect' table to see if any mailings have not responded in over 1 minute (or 1.5 - 2 minutes, just to be safer than with manual resumes). With this feature if a mailing stops responding for any reason (ie. server reboot, MySQL/web/mail service restarts or downtime) your mailing will resume shortly afterwards!
Regards