HTML Email for Comments, Trackbacks, etc.
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:
- Download the HTML Admin Email plugin here.
- Unzip the file (there is only one file in the zip archive) into your wp-content/plugins folder.
- 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
Hey Steve,
I’d like to use your plugin to format the notifications coming to me, but I’ve got to figure out how to get those notifications. As far as I can tell, I simply have to plugin the wp_notify functions (both postauthor and moderator) somewhere, but I do not know where/how. I’m sorry if this question is a little off topic, but any help you could give me would be much appreciated.
Thanks.
Comment by Nick — February 5, 2007
Nick, thanks for the note. In order to turn on comment and trackback notification, you need to set the appropriate setting in your WP Admin. Log into your admin area, then go to “Options” and click on the “Discussion” subpage. On there is a checkbox for emailing you whenever “anyone posts a comment.” Make sure that is checked and then click the “Update Options” button (there is one at the top right-hand of the page, and one at the bottom right-hand of the page, they both do the same thing).
The other thing that is necessary to get those emails is that you have a valid email address that you use to receive the notifications. This is set in your User Profile. Go to “Users” and then “Your Profile” in order to set that email address.
Once you have those things taken care of, installing my plugin will override the default email function and cause those messages to be formatted in HTML.
Does that information help? If not, let me know more specifically what you need help with, and I’ll do my best to help.
steve
Comment by Steve Sensenig — February 5, 2007
is their a way to use this plug in so that the person leaving the comment gets a confirmation that their comment was received?
Comment by marc — April 23, 2007
marc,
I’m sure it would be possible to notify the commenter themselves, but I’m not sure how annoying this would be to the commenter. And it’s kind of outside the scope of this plugin’s purpose.
On the other hand, are you talking about a comment held for moderation? If not, a person can just look at the site and see their comment to know that it was received. Or am I completely misunderstanding?!
If you give me more details, I can either point you in the right direction, or consider writing a plugin to do what you want.
Comment by Steve Sensenig — April 23, 2007
Hi Steve,
This plug in stopped working after I upgraded to 2.2 or whatever version we are up to now. Please let me know if you figure out a way to get it to work again.
Thanks!
Comment by Liana — June 2, 2007
Liana, I’m sorry to hear about this. I have not yet upgraded to 2.2, so I will have to find time to do that in a test environment soon and see what happens.
I am curious, though. Did you recently install any other plugins? The reason I ask is that when I started using Spam Karma (instead of Akismet), my plugin stopped working because Spam Karma had their own “wp_notify_postauthor” function.
If you did install some plugin that deals with post comments (such as Spam Karma), this could be the culprit instead of WP itself.
The only other possibility is that WP is now using a different function. I’ll try to find out for you.
Thanks for letting me know!
steve
Comment by Steve Sensenig — June 2, 2007
To my knowledge I haven’t installed Spam Karma. I did install a program that allows me to e-mail replies to my commenter from the blog but your program worked fine after that. It stopped after upgrading Wordpress.
Hope you find out something!
Comment by Liana — June 21, 2007
Hey Steve! Do you know of a plugin that sends a post via html email to a list of designated recipients? I’m putting a blog together for a missionary friend who is out in the field. He has never heard of a blog. Thus, he still wants the old fashioned html email update to go out. I was hoping to migrate him to a blog but have the posts automatically sent via email (as opposed to an email letting people know there is a new update). I know this is redundant, but it’s the only way I could convince him to half migrate his site to a blog format. Thanks for any and all help!
Comment by Jake — June 27, 2007
Jake,
There are plugins that allow people to subscribe to posts through email, but I’m not sure how easy it is for you to add emails yourself.
The solution I would suggest is publishing a blog and using Feedburner to manage the feed. Feedburner allows you to add emails to a subscription list, I believe, in which case any time a post is published, it will get sent to those email addresses.
This sounds like exactly what you need.
Comment by Steve Sensenig — June 27, 2007
[...] Visit [...]
Pingback by WP Plugins DB » Plugin Details » HTML Admin Email — August 13, 2007
i love it! thank you for your work..i really love your plugin!
Comment by manele — August 31, 2007
.i really like this plugin :X
Comment by manele noi — March 7, 2008