drupaldrupal-webformdrupal-rules

Send mail to email addresses from webform when content is edited


I am attempting to use the rules, webform and webform rules modules to send an email to the email addresses of fetched submissions after existing content is edited.

QUESTION: Can anyone see why my rules are not sending emails?

The rules I have configured are:

event -After updating existing content

Actions -Fetch webform submissions of node ID

Loop -fetched submissions

loop action -Send mail.

For the send mail TO field I have set the PHP evaluation field to:

<?php print $list_itemb->data['components']['email_address']['value'][0]; ?>

I have also tried:

<?php print $list_itemb->data['email_address']['value'][0]; ?>

I have attempted to follow the steps outlined in the below submission but it is still not working correctly.

Link: https://drupal.stackexchange.com/questions/69134/send-mail-to-email-addresses-from-webform-when-a-content-is-saved

EXPORT OF RULES:

{ "rules_test_form_final" : {
    "LABEL" : "Test form final",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "webform_rules", "php", "rules" ],
    "ON" : { "node_update" : [] },
    "DO" : [
      { "webform_submissions_load" : {
          "USING" : { "nid" : "3333" },
          "PROVIDE" : { "submissions" : { "submissions" : "Fetched submissions" } }
        }
      },
      { "LOOP" : {
          "USING" : { "list" : [ "submissions" ] },
          "ITEM" : { "list_itemb" : "Current list item" },
          "DO" : [
            { "mail" : {
                "to" : "\u003C?php print $list_itemb-\u003Edata[\u0027components\u0027][\u0027title\u0027][\u0027value\u0027][0]; ?\u003E",
                "subject" : "final test",
                "message" : "test",
                "language" : [ "" ]
              }
            }
          ]
        }
      }
    ]
  }
}

Solution

  • Calling submission data using the fetch submissions action in the Drupal Rules module changes the format of the array.

    The correct call is below:

    <?php print $list_itemb->data['61'][0]; ?>