WP-Cron-Mail plugin
posted at around evening time by Constantinos. Filed under Code, Review, Terminal, Web Standards, Windows, WP Plugin This post was originally published in 2006
The tips and techniques explained may be outdated.
Another tool I decided to use was WordPress’ post-by-email feature. However this was very limiting, as after posting via email usually action was required within WordPress – visit the wp-mail.php page, and then modify the post to place it in the necessary categories etc.
The first problem is overcome by using the wp-cron-mail plugin which comes with the wp-cron plugin. However I still wanted some more functionality from this.
My modification to wp-cron-mail.php accomplishes the following things:
- Adds the option of specifying which categories the post should be placed in. This is accomplished by (optionally) having the first non-empty line of your email message be in the form of:
{* Category Name, Another category name, catID *}
where “Category Name” can be any text. If the specified category exists it will be correctly identified, if not it will be created. catID needs to be the ID number of an existing category. You can use either method to define categories, or both of them together. - Limits posting to registered users only. When an email is received the plugin will try to match the Reply-To: address (or if that does not exist, the From: address) with all the emails of the registered users. If such an address is found, then the owner of that email address will be assigned as author (as with the default version of this plugin). Even though posting this way is strictly limiting, the option to override this is provided through the Options page, where you have the ability to either allow all email addresses, or provide a list of additional allowed email addresses (which can be empty – the default). With either of the last two options, if a message is posted from a non-registered email address, it will be marked as authored by the admin of the blog.
- Added the ability to replace wp-mail.php with a single function call to take advantage of the wp-cron-mail improvements, with the option of sending a notification email if posts are retrieved through this file, instead of just outputing the results to the browser.
- Added an Options page in the admin section to manage a lot of the configurable options of this plugin.
You can download a copy of this file in a zip archive or a tarball, which include a README file with instructions for replacing wp-mail.php. Before you use these files however, you should make sure of two things: that your wp-mail.php file is indeed working (to ensure that you do not suffer from the known bug that WordPress is still suffering from), and also that you have a working installation of wp-cron-mail. Then you can go ahead and replace that file with the one found here.
As always, no guarantees, and there is always room for improvement. I haven’t changed the code from the original wp-cron-mail, merely added to it. And it seems to be working, both this and the previous post were posted using this plugin :). Feel free to comment.
UPDATE: Apparently something went wrong with this plugin… If you visited this site in the first 3 hours after this post was posted, you would notice something very strange… all spaces were encoded as “=20”!!! I need to track this down…
1. Comment by David Stembridge
on 11 Mar 2007 @ 12:47 am
I have been trying the WP-Cron-Mail plugin, and have noticed that when my partner send a note to the mail address, it doesn’t post properly on the blog. It seems to be working fine for me.
Any ideas?
Thanks!