On this weblog, I use Movable Type version 2.x and the MT-Blacklist 1.6.5 plug-in for the management of comment spam. As I mentioned in this article, it can be really time consuming to manually process all the incoming spam notification emails from MT-Blacklist. I’ve now implemented a solution to help automate this processing. It’s not perfect, but it is saving me a lot of time.
The system is based on the following MacOS X tools:
* Apple Mail
* Apple Safari
* BBEdit 8
* PHP 4 (assuming you have the CLI version of PHP available at /usr/local/bin/php)
In addition, you’ll need the following files:
* mtCommentDespam.php. This PHP script to be placed in your BBEdit Unix Filters folder (~/Library/Application Support/BBEdit/Unix Support/Unix Filters), and you should edit the file changing the
yourserver.com value to something appropriate.
* MT-Despam-Prep. This BBEDit 8 Text Factory.
The following is the procedure:
- Select any number of MT-Blacklist comment spam notification emails in Apple Mail, and do a Save As… to save this group of emails to a single file somewhere. (Use the Raw Source file format.)
- Open the saved file in BBEdit 8.
- Process the opened file with the MT-Despam-Prep Text Factory in BBEdit 8. This will result in a window containing the comment IDs for all the comment spam messages.
- Do a Select All in this BBEdit window, to select all the comment ids.
- Execute the mtCommentDespam.php filter from BBEdit (#!->Unix Filters)
If everything’s working, Safari will open a window showing the results of each comment spam deletion. You can close all the windows at once by option-clicking the close widget in any window.
##### How this works
The BBEdit text factory (MT-Despam-Prep) removes everything in the saved messages file, leaving only the ids of the comment spam messages to be deleted (one id per line). The PHP script (mtCommentDespam.php) then builds an appropriate comment spam delete URL (without confirmation), and sends that URL to Safari to be opened.
Using this method, your MT-Blacklist exclusion list will not be updated — a trade-off I’m willing to accept.
For this to work, you will have to have successfully logged into your Movable Type system once during your Safari session, otherwise you’ll be receiving a lot of login screens.
I have no idea if this works with MT-Blacklist higher than 1.6.5. It could well be that the URL syntax for a non-confirmed comment deletion has changed.