2

I have a RULE that works well:

  1. After saving a new content of type DEMO
  2. Send node as HTML formatted email Parameter: Send email to:[email protected],[email protected]

What I need is to send the same Action but to a "users of a role", something like

  1. After saving a new content of type DEMO
  2. Send node as HTML formatted email Parameter: Send email to: Roles: Editor ---Rules does not allow to add roles here---

Is there any module that can expand this function in RULES? Or is there some way to achieve this directly within RULES? Thanks

2
  • I did try and it didn't work as need it. I'm still looking...
    – user28697
    Commented May 6, 2014 at 16:05
  • You could use tokens to load your node body and set Mime Mail to use your site css ...
    – Kojo
    Commented May 6, 2014 at 16:40

4 Answers 4

1

It may depend on your config. Here's a solution relying on Mime Mail and Mail System, as Mime Mail integrates smoothly with Rules.

Download and enable these 2 modules. Then you'll have a few steps configuring it :

  1. Mail System: select MimeMailSystem in both "Site-wide default MailSystemInterface class" and "Mime Mail module class" drop-down list.
  2. Mime Mail: change it from "Plain text" to "Filter HTML".

Now when you edit your rule, you'll see an action "Send HTML mail to all users of a role". Select editor role. You're done :)

Find even more details in this step by step tutorial: How to Send HTML Emails in D7 using Rules

EDIT : Alternative solution.

  1. Download simplenews and enable both simplenews and simplenews rules. Set up the module.
  2. Create a editors newsletter. Deactivate Subscription block
  3. Enable "Use as simplenews newsletter" in the content type options you wish to send as HTML formatted email.
  4. Create a rule : after editing a user account, condition user has role editor, subscribe user to newsletter editors (and reverse rule to unsubscribe)
  5. Create a rule : after saving a node, condition content-type is..., send newsletter :The newsletter node to be sent.: [node]
1
  • @user28697 I added another solution I've tested. I've got these modules installed on a test site, and the rule part itself is peanuts to set ut. Before you'll have to configure correctly your simplenews module and Mime Mail but this is quite easy and well documented
    – Kojo
    Commented May 6, 2014 at 17:38
0

Not exactly the same scenario, but this has step by step instructions on how to do something similar - might help guide you in the right direction.

Email users on node creation based on taxonomy reference

0

You can use Mime Mail module for this.

Add action rule as "Send HTML mail to all users of a role" and select the editor role from the dropdown.

Refer: https://www.webwash.net/how-to-send-html-emails-in-drupal-7-using-rules/

0

You could use the Views Rules to get this to work. Here is a blueprint of how to do so:

  • Create a view of all users with role "Editor" (as in your question).
  • Improve your existing rule to create a "Views loop", which is similar to a regular Rules loop, but allows looping over rows of view results.
  • Within that "Views loop", perform a Rules Action to Send node as HTML formatted (similar to what you already have in your existing rule).

For way more details on this, refer to ("Option 2" of) my answer to "How to use Rules to send an E-mail after saving a new comment, to users who checked a boolean in their profile?"

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.