Send email to users, except author comments

Hello!

I have node with field [field_users] (entity reference)

I create rule [after saving new comment] Actions: Loop for field: [comment:node:field-users] inside loop i create var [users:mail] And add action for sending emails...

But problem is:

if comment-author in list of field_users, emails sent also to author comment

Q: How to remove comment author from loop?

Thanks for any help!

You need a condition to check if the author of the node and the current user in your loop are the same; if not, then you can send the email.

To do that, you need to do the following:

1. Create a Rules component of type "Rule", this will give you an action option inside your loop.
• Component Plugin: "Rule"
2. Configure your component to expect two parameters; the node's author and the comment's author. Both should be of Data type "Entity > User".
3. The component must have a condition to trigger only if the comment author NOT EQUALS the node author
4. The component's actions can be the same as the ones you have already created.
5. After you save your component, go inside the loop of your original rule and add an action; you should be able to choose the component you created earlier.

Good luck!

You can install Rules Conditional module, which will give you an option to run conditional logic inside a Rules Action, in your case related to the loop that you created.

So, you'll do a check in the loop as follows:

IF comment:author:mail NOT EQUAL users:mail THEN send email