I have a view of nodes that I edit with VBO. I filter this nodes by author. When I edit this nodes I send a mail to author with a rule but I have a problem when I edit more than one nodes with VBO. In fact Rule sends as many email as they are the nodes.

How I can do to send only a single email to the author that I have filtered in the views?

I use Drupal 7.

UPDATE: I've added the rule that I'm using but not works

{ "rules_send_mail_to_owner" : {
"LABEL" : "Send Mail to Owner",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "rules_i18n" ],
"ON" : { "node_update--prenotazione" : { "bundle" : "prenotazione" } },
"DO" : [
  { "variable_add" : {
      "USING" : { "type" : "list\u003Cuser\u003E" },
      "PROVIDE" : { "variable_added" : { "variable_added" : "Added variable" } }
  { "list_add" : {
      "list" : [ "variable-added" ],
      "item" : [ "node:field-proprietario" ],
      "unique" : "1"
  { "LOOP" : {
      "USING" : { "list" : [ "variable-added" ] },
      "ITEM" : { "list_item" : "Current list item" },
      "DO" : [
        { "mail" : {
            "to" : "giupenni78@gmail.com",
            "subject" : "Prova notifica LCS",
            "message" : "Questa \u00e8 una prova\r\n[node:field-proprietario]\t",
            "from" : "info@lowcostsicilia.it",
            "language" : [ "" ]

Here is a blueprint to do what you're asking about:

  • Create a new variable, which you define as a "list of users" (so that you can use this list later on to "loop through this list").
  • Replace the "send an eMail" (within your existing Rule) by an action to "Add an item to a list" (using the list you created via that new variable). When doing so, you make sure to set "ENFORCE UNIQUENESS" to true, so that you "only add the item to the list if it is not yet contained" (see where I'm going?).
  • In the end, the value of the new variable will contain a list of unique users. So just add another Rules loop (at the end?), to iterate over each of the users in that list. And guess what you can then do in this additional Rules loop ... indeed: send an email to each of those users. And since each user is only contained 1 time in that list, they will only receive 1 eMail.

Easy, no?

  • Thank you @Pierre.Vriens but I not understand how I can create a new variable
    – kb8
    Jul 26 '18 at 9:34
  • @kb8 could you provide more details about that "editing of nodes with VBO", and how your rule is related to that? depending on what you did, I can improve or rework my answer then, OK? Jul 26 '18 at 10:55
  • I use VBO to change a field (checkbox) of a node or more in the same time. I've try to solve with you answer but Rules still to send more than one email for user. I've integrated my question with the rule that I'm using.
    – kb8
    Jul 26 '18 at 11:49
  • I've created in Action a new variable and after I've followed step by step your answer but Rules still to send many emails as there are selected nodes. If it can be useful: the Author is not the user that has created the node but is assigned in a Entity Reference Field.
    – kb8
    Jul 27 '18 at 15:52
  • seems that "ENFORCE UNIQUENESS" to true not working @Pierre.Vriens
    – kb8
    Jul 30 '18 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.