1

I have installed Mime mail and Mail System modules. I use an action in a rule:

Send HTML mail to all users of a role

to send an email to a set of users.

Is there anyway I could limit the number of email sent per hour? For example, if the execution of this rule has to send 100 emails, It will be sent in blocks of 50 emails per hour.

I think It should be queue in cron.

1

Below is a summary of how you can get this to work:

  1. Use the Flag module and introduce a flag to allow "flagging" all those "users of a role" (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. Adapt the rule you already have, like so:

  3. Use the Views and the Views bulk operations (VBO) modules to create a VBO list of all flagged users (flagged by the new flag in step 1), sorted by flagging date (oldest first), and limit the results to the first 50 users only (50 is the value that seems to fit 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:

    • Send HTML mail to each of the users in that VBO list.
    • Unflag (using flag from step 1) 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 execution of the same rule within 1 hour (1 hour is the value that seems to fit 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 hour, Rules will notify 50 users "as requested".

  • Thanks very much. I think It's the right solution for my problem. – briast May 30 '17 at 11:58

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.