How can I make a checkbox for turn-off/on sending e-mail notifications to users each time when I publish or change a node (in Drupal 7)? I mean, I don't need to send notifications each time I changed a node (or published it).

I used an editor interface in Drupal 6 (maybe earlier) and it included a similar checkbox: I could turn-off/on sending email notification to users. Here is a picture of it (last checkbox):

enter image description here

  • should this checkbox be per node edit/publish or per user, so that each user may decide whether or not he/she wants to get notificated? – Alex Jan 26 '15 at 15:55
  • It should be per node – Yashaziro Jan 26 '15 at 15:58
  • 1
    create your own module and use the form alter hook, then add your own submit function and check, in the form state, if your field is checked. then send a mail :) – Alex Jan 26 '15 at 16:04
  • alternatively add a custom block that exposes a drupal form with the checkbox. Then set a drupal variable to use it later in a rule or another hook – Nikos Tsagkas Jan 27 '15 at 10:38

Unless you want to re-invent the wheel, you should have a look at the Message Stack, which does exactly what you are asking for (and much more ...). The Message Stack consists of these modules (quotes are from the module's project page):

  • Message:

    The Message module is the core of the message stack. It enables logging and displaying system events in a number of different use cases. Events that are recorded over time are sometimes call activity streams. Exportable messages subtypes can be created for different use cases with custom fields and display (view) modes.

  • Message Notify.

    This module provides a method for sending a message via a notifier plugin. Message Notify comes with plugins for email and SMS and may be extended to other transport mechanisms as required.

  • Message Subscribe.

    With this module, users who subscribe to content will be notified when events occur that involve that content. The module leverages the Flag module, which provides a subscribe functionality to users.

These are the basic components and dependencies of the message stack:

enter image description here

Quite a few popular Drupal distributions already adopted to this Message Stack, such as such as Commerce Kickstart, Drupal Commons, ERPAL and Open Atrium.

If you want to have a closer look at the Message Stack and see it at work in your own environment, then experiment a bit with the Answers module (disclosure: I'm a co-maintainer), together with the Answers Notification sub-module, which allows logged in users to subscribe to selected questions (= nodes of content type "Question"), and so that they receive notifications (using the Message Stack) when Questions receive Answers (= nodes of content type "Answer").


You can easily do this using rule module. Follow below steps for your case:

  1. Create a tern_on_off (Boolean type) field in the content type.
  2. Create a rule with event update node and in condition add data comparson and compare tthe value of tern_on_off. and in the action add Send mail under System and add the data.

You are done.

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.