Feb 01

HTML Email for Comments, Trackbacks, etc.

Filed under: Admin plugins | Back to: Homepage

I recently attempted my first plugin for WordPress. It’s nothing fancy, but it does something that I was unable to find elsewhere. On the recommendation (and with the tremendous help of) Otto42 on the WordPress support forums, I was able to accomplish my task!

When someone comments on my WordPress blog, WP sends me an email with the comment in it (typical of most blog systems). However, the emails were in plain text, so I didn’t see any formatting any of my commenters used. I also have a Scripturizer plugin installed that automatically converts Scripture references to links to BibleGateway’s site, and those couldn’t show up in the plaintext emails, either.

I looked quite a few times for something to convert those emails to HTML format, but to no avail. Finally, I posted on the support forums about it, and Otto42 told me that it could be accomplished by a plugin, and gave me the instructions on how to override pluggable functions in WP.

It only took a few hours to get the basic concept down, and after quite a bit of tweaking, I think I finally have it the way I want it.

Please bear in mind that this is my very first plugin ever, so there may be some things that need to be modified on it. There are absolutely no options to be set on this plugin yet, so it’s simply a plugin file to be installed and activated. Here are the instructions:

  1. Download the HTML Admin Email plugin here.
  2. Unzip the file (there is only one file in the zip archive) into your wp-content/plugins folder.
  3. Log in to your blog’s admin interface, click on Plugins, and activate the “HTML Admin Email” plugin.

That should be all there is to it. Next time someone leaves you a comment, trackback, or pingback, you should receive an HTML-formatted email with the formatting of the comment intact (provided that you already have your blog configured to email you comments, etc.).

This plugin is still very new, so I have labelled it as version 0.8. If I get some feedback on it, and end up making changes and creating an options page for it, I will make a 1.x version and make it really official. For now, though, please consider this as something of a beta. Any comments are quite welcome! :)

Update 2/4/07: I’m having very intermittent success (read: almost constant failure) with this plugin in version 2.1. I have no idea why, but it seems to be ignoring my plugin completely on all but 1 comment email. Hopefully I’ll be able to figure this out soon. Stay tuned!

Update 2/5/07: The problem actually was with Spam Karma 2, which also declares a function called wp_notify_postauthor to override the pluggable function. If you are running any kind of spam filter plugin, you may have a similar problem. You have two options, as I see it: 1) Delete the function from the spam plugin so that this one gets called, or 2) replace the function in the spam plugin with the one in my plugin. Either way can be tricky, and you will lose whatever functionality the other plugin wrote into that function.

Thanks!

steve :)