My Orchard comment notification rule
The Rules module in Orchard enable you to set-up “if this then that” types of rules. The system is fully extensible in terms of what “this” and “that” are of course, but Orchard comes with everything you need out of the box to set-up comment notifications. Let’s create this rule:
Before you begin, you need to make sure you have the rules features installed and enabled.
For comment notifications, “this” is: “when content with type comment is published”, and “that is: “send an e-mail”.
In order to reproduce this, create a new rule named “Content Notification”. Add an event, choose “Content Published” and select “Comment” as the published type:
Now we will add a “Send e-mail action”. As the recipient of the e-mail, I usually set “Site Admin”, but many people will want the mail to be sent to the owner of the blog. To get that result, you can select “Other” with the following pattern:
{Content.CommentedOn.Container.Author}
As the subject of the e-mail, I use this pattern:
nwazet.com: A new comment has been posted by {Content.CommentAuthor}
Finally, as the body, I use the following:
<p>New comment by {Content.CommentAuthor} on {Content.CommentedOn.DisplayText}</p> <p>{Content.CommentMessage}</p> <p><a href="http://nwazet.com/admin/comments">Moderate</a></p>
Once you’ve saved all that, don’t forget to enable the new rule, and you should now get an e-mail every time someone posts a comment. Oh, one last thig: you need e-mail settings to be correctly set-up for this to work, naturally.