0

In Drupal 9, I need to notify all users belonging to a role by sending them an email about the new created content.

Everything's fine, but I don't know how to put together the email addresses of these users in the Send to data selector of the Rules module.

2 Answers 2

0

In Rules there's a "Send email to all users of a role" action you can use for this purpose. There is no "Send to" input for this action because all you need to do is specify the role, not the email addresses.

1
  • What exactly should i insert into the "Send to" text box? the machine name of the user role? Or its full name? If i insert administrator there, i get an error on the new node creation" Error: Call to a member function id() on string ve funkci Drupal\rules\Plugin\RulesAction\SystemEmailToUsersOfRole->Drupal\rules\Plugin\RulesAction\{closure}() (řádek 125 souboru /mnt/data/accounts/b/buffaloo/data/www/nohec.tingz.cz/modules/contrib/rules/src/Plugin/RulesAction/SystemEmailToUsersOfRole.php) Jun 11, 2021 at 7:40
0

As anonymous indicated, use the "Send email to all users of role." I believe roles are identified by number. If you go to /admin/people/permissions/roles, and hover over 'edit permission,' the number at the end of the url should indicate the id for the role.

1
  • 1
    Roles are identified by the machine ID of the role, which is usually a string in Drupal 8 and 9. For example, then "Authenticated" user role has a machine ID of "authenticated". This input will be replaced with a select box in then near future, where you may simply select from the site's existing roles rather than having to type in a machine ID.
    – anonymous
    Jun 13, 2021 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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