Drupal Comment Notification Automation

So, I read this post on the OS Training website showing how to set up an automatic notification of comments on Drupal blogs which was pretty close to exactly what I wanted. I’m constantly getting blog comments but 99.9999% are spam. I long ago turned off unmoderated commenting. I can almost turn off commenting altogether, but that’s not what I want. Sadly, even CAPTCHA does not eliminate the dedicated spammers. So, I ignore my blog comments moderation queue for months at at time because it’s an obnoxious chore to dig through it for the possibility of a real comment.

The automated email that gives you all the information you need to decide if your attention is required to free a real comment is just what the doctor ordered. When/if you ever get a real comment, you can bounce into free it and then spend a minute doing a mass delete on the spam, minimizing your maintenance time.

The information at OS Training is not quite plug and play, however. I found that the [node:author:mail] didn’t work. Most of the other tokens worked a charm, but the node ones didn’t convert, coming through exactly as typed which made my mail system deeply unhappy.

A little fiddling and printf style debugging showed comment:node:... to work.

Thus, this is the incantation that works in my Action triggers:

Recipient: [comment:node:author:mail] Subject: New blog comment [comment:node] Message: Link: [current-page:url] On: [comment:created:medium] By: [comment:name] Email: [comment:mail] [comment:node] (([comment:node:url])) Comment Title: [comment:title] [comment:body]

You’ll notice that I added in some URLs for more context. Always err on the side of more info.

Now, all I need is to formulate a link to one-click delete the spam or one-click approve a valid comment. Some other time…