You are here

function queue_mail_mail_alter in Queue Mail 7

Same name and namespace in other branches
  1. 8 queue_mail.module \queue_mail_mail_alter()

Implements hook_mail_alter().

File

./queue_mail.module, line 53
The Queue Mail module.

Code

function queue_mail_mail_alter(&$message) {
  $mail_keys = variable_get('queue_mail_keys', '');
  if (drupal_match_path($message['id'], $mail_keys) && $message['send']) {

    // if message is already set to NOT be sent do not queue it
    if ($message['send'] != FALSE) {

      // Store the message for sending on cron.
      _queue_mail_get_queue()
        ->createItem($message);

      // And prevent the message from being sent instantly.
      $message['send'] = FALSE;
    }
  }
}