2

I've set up a workflow rule to send an email to all users of a role when new content is saved. I've tested it with three test users and have noticed that the email takes quite a while to actually be delivered.

I thought it was related to cron, so, I changed the setting to Run cron every 1 hour. The emails are eventually delivered, but, not in a timely fashion. It seems like they're delivered according to the cron schedule, but, I'm not sure.

I'd like to have the emails sent as soon as possible when the content is posted. Some of the content can be time sensitive. Is there any way to speed the delivery of the email?

  • Actually, that's not a bad suggestion. I'll have to look into it. – rrirower Jul 28 '16 at 19:01
  • So are you OK with an answer that would use Rules instead? – Pierre.Vriens Jul 28 '16 at 19:03
  • @Pierre.Vriens I haven't had a chance to look into it. – rrirower Jul 28 '16 at 19:04
  • @Pierre.Vriens Ye, it looks like that would be an acceptable workaround. – rrirower Jul 29 '16 at 15:36
1

As an alternative to what you're trying to get to work, you might want to consider using the Rules module. Below is a summary of how you can get this to work:

  1. Introduce an additional flag to allow "flagging" these (new) nodes by all users "with the role that should receive these eMails" (as in your question). Let's assume you label that flag as "eMail notification outstanding" (to indicate that something still needs to happen to send that eMail later on).

  2. Create a rule to flag the newly saved content, using the new flag (from step 1) for each of the users "with the role that should receive these eMails". A possible approach for this is to build a list of these users using Views bulk operations (VBO) module, which is then processed by the rule to actually flag this content by those users.

  3. Use the Views and the Views bulk operations (VBO) modules to create a VBO list of all flagged nodes (flagged by the new flag in step 1), sorted by flagging date (oldest first), and limit the results to the first X users only (pick a value for X that fits your needs).

  4. Create a new Rules Component that "loads the VBO list" (from step 3) and add a loop to that rule to perform these Rules Actions:

    • eMail each of the users in that VBO list.
    • unflag (using flag from step 1) the node (for the user for which you just produced an eMail). This to indicate that the eMail notification was completed (no longer outstanding).

    • In that same rule, as the very last Rules Action, add an action to reschedule the exectuion of the same rule within Y minutes or hours (pick a value for Y that fits your needs).

  5. Use the Rules UI to manually trigger the very first execution of that self-rescheduling Rules Component (from step 4.).

Using the above approach, every Y minutes (or hours), Rules will notify X users "as requested". Obviously, you'd have to think a bit about what the best values for X and Y would be in your case. E.g. if you have thousands of users in that role (to receive the eMails), you've to be careful to prevent that your eMails would be considered as spamming. However, if you only have a few users in that role, you should be OK with a low value of Y (even like every 5 minutes or so?).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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