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:Comment notification 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:Choose the Comment 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:


As the subject of the e-mail, I use this pattern: 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><a href="">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.


  • Pure and simple. That's the reason to love Orchard rules system!;)

  • Nice one

  • Thanks Bertrand =)

  • Bertrand,

    Nice post and rellevant post, as always.

    Is there any way we can import/export the rules that we have applied in one site to another one ?


  • @Carlos: not at the moment, it's an oversight that we'll fix. Feel free to file a bug to track it, as I don't think there is one yet, but this definitely needs to be done.

  • Hi Bertrand, I have a question regarding storing field values manually for BlogPostPart? so far I know that whenever I create a new BlogPost it creates a field record empty in the FrameworkContentItem record of the database...but what if I want to manually add a particular field or access it's data that I assigned as a field part to content item? is that possible in Orchard and if yes would you please kindly point me to the right direction...? I know that blog post part is treated as ContentItem but let's say I have a field as Taxonomy so should what type should I give in the _contentManagement.create services TaxonomyFieldPart, or contentItemPart or blogcontentItem?

  • @Aamir: it would be best to post that on the discussions forum, so that others can find it and benefit from any answers. In a nutshell, yes you can access fields. The easiest is to cast the ContentItem to dynamic and access the field through something like item.ThePartThatHasTheField.TheField.TheFieldProperty.

  • Bertrand,

    I've noticed that Conditions are provided as an available "Action" for the rule. I've been trying to use them but have been unsuccessful as I have not been able to find any documentation on the matter. I see they use scripting but I cannot generate a script that actually validates. Can you shed some light into this?

    Additionally, having the Condition as part of an Action is very unintuitive. This should be a separate behavior for a Rule, so a Rule should be comprised of an Event/s, a Condition which needs to be satisfied for the Action to be triggered, and the Action/s.

  • @Frank: I don't understand what you're saying. Can you please ask your question on the discussions forum on CodePlex, giving as many details as possible?

  • But {Content.CommentedOn.Container.Author} returns the name of the owner, not the email ? (unless you used an email for username)

  • @Antoine: that should be a user token, which itself has sub-tokens.

Comments have been disabled for this content.