Back in the Drupal 5 days, there was a wonderfully made little module called: Comment Mail that would e-mail the site administrator if there were any new comments on the site needing approval. While there is a D6 version of the module, it has not been maintained since Nov 2008 and even posts that there are some bugs with the module. This inspired me to figure out a way of doing the same thing with a few other modules. While I believe the way I have devised is a bit overkill, it does the job :)
Now, some may be saying "Why not just use Drupal 6 Actions and Triggers?" The reason is because it doesn't really give any usable support for tokenized messages... (D7 is supposed to be different... I hope...) Since the "Token Actions" for Drupal... well... completely sucks, I decided to use the Rules module instead which pulls the full functionality of the Token module into play... Top it off with the LoginToboggan module and you are ready for comment approval e-mails to start flooding in! There is another post on JasonHooker.com which gives great instructions on how to setup the rules module to do all of this, but he didn't go into detail on how to really make the e-mail message shine. This is where I want to kind of pickup where he left off... I will explain how to set everything up from start to finish, but if you need some help with the rules, you might check his site.
First off, the Rules module is VERY powerful in what it can do with Drupal... It might seem a bit intimidating but don't let it scare you. After you make a few rules, it's one of those "Ooohh... I see what they're doing!" scenarios.
The Token module is a passive module meaning there aren't any configuration screens for it. If another module needs it and it's there, you get a list of tokens to use. That simple. Chances are, if you are using Pathauto, you are already using the Tokens module.
The (optional) LoginToboggan is more a site where there are a lot of users, but there is one little itty-bitty setting that needs to be turned on for everything to come together smoothly.
Leave the check next to: This rule is active and should be evaluated when the associated event occurs.
Weight: (You can leave at 0)
Click the Save changes button.
You should now see a screen that shows:
ON event After saving a new comment
+ Add Action
+ Add Action
A new comment has been posted on: [comment:site-url] at the following location: [comment:site-url]/node/[comment:comment-nid]#comment-[comment:comment-cid] Approve the comment: [comment:site-url]/admin/content/comment/approval Name: [comment:comment-author-name-raw] Email: [comment:comment-author-mail-raw] Homepage: [comment:comment-author-homepage] Subject: [comment:comment-title-raw] Message: [comment:comment-body-raw]
Weight: (Just leave at 0)
Scroll all the way to the bottom to the Other section and set the following:
Present login form on access denied (403): Enable
Note: If you have multiple users that login to your site, you might want to go through the LoginToboggan settings a little more in-depth to make sure the login & registration process is to your liking.
That's It! Go send yourself a comment and test it out! : )
If you want to customize the e-mail message, feel free to play around with the different tokens available. What I have presented is probably enough information for most folks... Keep in mind though, that the actual comment URL won't work right until the comment has been approved.
Update: 2010/02/21 It was brought to my attention that Token Actions will allow you to create an advanced action as "send tokenized email..." using the core Drupal Triggers / Actions. While I suppose this could be used to construct the above Rules, I personally have not tested it's output to see if the e-mail generation is similar to the Rules option above. Theoretically though, it should work pretty much the same.