{ "rules_new_general_announcement_notification_rule" : { "LABEL" : "New General Announcement Notification Rule", "PLUGIN" : "reaction rule", "TAGS" : [ "announcement", "content", "email" ], "REQUIRES" : [ "rules" ], "ON" : [ "node_insert" ], "IF" : [ { "node_is_published" : { "node" : [ "node" ] } }, { "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "announcement" : "announcement" } } } }, { "data_is" : { "data" : [ "node:field-announcement-type:name" ], "value" : "General Announcement" } } ], "DO" : [ { "entity_query" : { "USING" : { "type" : "user", "property" : "field_email_preferences", "value" : { "value" : { "general_announcements" : "general_announcements" } }, "limit" : "250" }, "PROVIDE" : { "entity_fetched" : { "users_to_notify" : "Users to Notify" } } } }, { "LOOP" : { "USING" : { "list" : [ "users-to-notify" ] }, "ITEM" : { "user_to_notify" : "User to Notify" }, "DO" : [ { "mail" : { "to" : "[user-to-notify:mail]", "subject" : "A [node:field-announcement-type:name] has been published on [site:name]", "message" : "[user-to-notify:field-first-name],\r\n\r\nA new [node:field-announcement-type:name] has been published at [site:url] by [node:author].\r\n\r\nThe title is [node:title].\r\n\r\nYou can read it at [node:url].\r\n\r\n\r\n*You received this message because you\u0027ve indicated that you wish to receive emails when [node:field-announcement-type:name] content is published. You can update your notification settings at any time by editing your user profile at [user-to-notify:edit-url].", "language" : [ "" ] } } ] } } ] } }