How to send an email when the content is unpublished? I'm using the Rules module for sending emails. When the user adds a node, it can only be published when the admin approves it. For this I have used the content approval module.

I have made a rule which sends an email to the user when their content is published.

How do I create a rule which sends an email to the user when their content is not approved or unpublished?
hook_scheduler_api() accepts two parameters - 

1. $node is the node object being processed
2. $action is either 'publish' or 'unpublish'


hook_scheduler_api()

&lt;?php
    function yourmodule_scheduler_api($node, $action) {
  if (some condition) {
    // parameters: drupal_mail($module, $key, $to, $language, $params = array(), $from = NULL, $send = TRUE) {
    drupal_mail('yourmodule', 'mail key', $user-&gt;mail, etc depending on your needs);
  }
}
?&gt;


hook_mail()

&lt;?php

function yourmodule_mail($key, &amp;$message, $params) {
  switch ($key) {
    case 'this-mail-key':
      $message['subject'] .= 'your subject';
      $message['body'][] = 'text';
      // etc ...
      break;
    // etc ...
}
?&gt;