1

I'm using Drupal 7 and I need to send a weekly mail to all users.

I want to use the Rules module to do this. But I couldn't find a Rules Event which allows for this.

How can I implement that?

  • 1
    Refer this tutorial.. – Abin Mar 8 '17 at 10:29
  • weekly mail based on what thing? Like whether its about new content until it gets published.? – Gaurav Rajdeo Mar 8 '17 at 10:30
  • Thanks for your response Gaurav Rajdeo, Abin and Glorfindel. I had already solved it by creating a custom module to run a cron weekly and schedule it to sent every thursdays using Elysia cron module – bincy Mar 16 '17 at 9:44
1

Below is a blue print of how I would resolve this challenge, without any custom code needed ...

Step 1: Enable the 'Rules Once per Day' module

Have a look at the "Rules Once per Day" module. Here is how it works (as per the comment in issue 2495775, from the module owner):

  • You specify a trigger hour on the administration settings page for this module.
  • The Rule trigger will then run when cron tasks are first run after the start of that hour. The actual run time will depend on your cron task timings.

So this is another way to understand/Read this:

  • The "Event" will only be triggered when a cron job is run.
  • And that event will only be triggered 1 time / day, i.e. "next time cron runs after the trigger hour has passed".

On top of that, also note what's mentioned on its project page, ie:

The module also provides a "Day of the week is a" Rules condition, to further restrict actions to being run on specific day(s) of the week, on working days only, or at weekends only.

With that, you should be able to adapt any rule to perform its rules actions only once a week.

Step 2: Create your custom rule

As per your "mail to all users" requirement (for which you want to use the Rules module), just create some custom rule to do so. The most straight forward Rules Action to use for this, seems to be "Send an eMail to all users of a selected role", whereas role is just authenticated users.

If however you want more granularity in the set of users to be selected, you could use the Views Rules module instead. for more details on such approach, refer to the Plan b part of my answer to "What's wrong in my rule for sending e-mails using VBO?".

  • It may work, I hope. But I had already solved it in another way since that was an immediate requirement for the client. :) – bincy Mar 22 '17 at 8:18

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.