You are here

function message_notify_rules_process in Message Notify 7.2

Same name and namespace in other branches
  1. 7 message_notify.rules.inc \message_notify_rules_process()

Action: Process and send Message.

1 string reference to 'message_notify_rules_process'
message_notify_rules_action_info in ./message_notify.rules.inc
Implements hook_rules_action_info().

File

./message_notify.rules.inc, line 75
Rules integration for the Message notify module.

Code

function message_notify_rules_process(Message $message, $save_on_fail, $save_on_success, $rendered_subject_field, $rendered_body_field, $mail = FALSE) {
  $options = array(
    'save on fail' => $save_on_fail,
    'save on success' => $save_on_success,
  );
  if ($rendered_subject_field && $rendered_body_field) {
    $options['rendered fields'] = array(
      'message_notify_email_subject' => $rendered_subject_field,
      'message_notify_email_body' => $rendered_body_field,
    );
  }
  if ($mail) {
    $options['mail'] = str_replace(array(
      "\r",
      "\n",
    ), '', $mail);
  }
  message_notify_send_message($message, $options, 'email');
}