Score:0

Send an email to a group of users after new content has been created

de flag

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.

Score:0
fr flag

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.

Tomáš Bažant avatar
de flag
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) `
Score:0
in flag

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.

fr flag
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.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.