3

I created a rule for users, who subscribed on another user to get messages of this user new content:

Events
  EVENT 
    After saving new content
Conditions
  ELEMENTS
    None
Actions
  ELEMENTS
    Fetch users who have flagged a user
      Parameter: Flag: subscribe_this_user, user: [node:author]
      Provides variables: subscribers (user)

    Loop
      Parameter: List: [user]
      List item: Current list item (liker)

     Send mail
       Parameter: To: [liker:mail], Subject: New event on [site:name]!, Message: New content [node:title] by..., From: [site:name

How can I send these emails with delay? I heard that sending a lot of emails is spamming. I heard about Rules Scheduler, but don't know how to integrate that in my rule.

1

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 "who subscribed on another user to get messages" (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:

    • Remove the Rules Action "send eMail".
    • Flag the newly saved content, using the new flag (from step 1) for each of the users you already have in your existing list in your existing Rules Action.
  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 (you can probably reuse the Rules Action "send eMail" that you already had, but removed in step 2).
    • 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".

0

I think that deferring emails is the wrong solution for you here. A question like this often indicates the hosting may not be suitable for the site profile.

Unless it's part of your site model, a workaround of delaying delivery will just show user engagement. Over the course of a day you'll end up sending the same number of emails, so this won't reduce your chances of being flagged as a spammer.

What will work better is to ensure you use a reliable mail delivery mechanism, and avoid spam behavior (like sending excessive or unwanted notifications).

If your existing hosting limits outbound email, and you need to send more emails than the limits they offer, find a provider who does suit your needs (and will scale for future success). There are plenty of mail providers on the market for you to choose from, and options for reliable self hosted systems too.

  • I'm aware this doesn't answer the question at hand, I'm trying to assist OP by addressing the underlying issue rather than the symptom. – Chris Burgess May 28 '17 at 7:21

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.