I would like to use emails to communicate with users. So i really want to send a email message for all users(or just a number of users with specific role) when the site goes to the maintenance mode and send another one when the site comes online.

I checked triggers, rules, actions but couldn't find anything to help.

How can I solve this?

1 Answer 1


Checkout this module Maintenance mode API .

Maintenance mode API notifies other modules when the site is switched into or from maintenance mode.

This means that other modules can respond to this, for example:

Alerting a list of users when the site goes into or out of maintenance mode

This module provides a hook, hook_change_maintenance_mode which any custom modules can interact


You can create a custom rule set with actions as send emails to your desired users. (An example guide how to create it).

Then invoke the rule set using rules_invoke_event() function inside the hook hook_change_maintenance_mode

  • 2
    If we do this way how can we deal with email translation and email templates. It's good if we can create somthing like rules or triggers for that because we can have many benefits from email translation & templates.
    – Stone Vo
    Mar 6, 2013 at 11:11
  • 1
    you can call the custom ruleset inside the hook hook_change_maintenance_mode, see edits Mar 6, 2013 at 12:19
  • 1
    Yes. It worked. 1. I created two rules (offline and online rule) in my custom module. 2. Use the hook_change_maintenance_mode to detect the status and use rules_invoke_event() to call the rule. 3. From the rules UI. I just create action like "Send mail to all users of a role" and from that i can use email template or translation. The Maintenance mode API module is the key for that. Thanks
    – Stone Vo
    Mar 6, 2013 at 18:16

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.