You are here

function workbench_email_send_queue_email in Workbench Email 7.3

Send emails here.

Parameters

array $message: The message, as built and altered by drupal_mail().

Return value

mixed The message results.

1 string reference to 'workbench_email_send_queue_email'
workbench_email_cron_queue_info in ./workbench_email.module
Implements hook_cron_queue_info().

File

./workbench_email.module, line 229
Code for the Workbench Email Module.

Code

function workbench_email_send_queue_email($message = array()) {

  // Retrieve the responsible implementation for this message.
  $system = drupal_mail_system($message['module'], $message['key']);

  // Format the message body.
  $message = $system
    ->format($message);

  // The original caller requested sending. Sending was canceled by one or
  // more hook_mail_alter() implementations. We set 'result' to NULL, because
  // FALSE indicates an error in sending.
  if (empty($message['send'])) {
    $message['result'] = NULL;
  }
  else {
    $message['result'] = $system
      ->mail($message);

    // Log errors.
    if (!$message['result']) {
      watchdog('workbench_email', 'Error sending e-mail (from %from to %to).', array(
        '%from' => $message['from'],
        '%to' => $message['to'],
      ), WATCHDOG_ERROR);
    }
  }
  return $message;
}