You are here

function smtp_send_queue_runner in SMTP Authentication Support 7.2

Same name and namespace in other branches
  1. 8 smtp.module \smtp_send_queue_runner()
  2. 7 smtp.module \smtp_send_queue_runner()
1 string reference to 'smtp_send_queue_runner'
smtp_cron_queue_info in ./smtp.module
Implementation of hook_cron_queue_info().

File

./smtp.module, line 170
Enables Drupal to send e-mail directly to an SMTP server.

Code

function smtp_send_queue_runner($message) {
  $logging = variable_get('smtp_debugging', SMTP_LOGGING_ERRORS);

  // Legacy for mails queued before 7.x-v1.3
  // What was passed to the runner used to be a PHPMailer object, not a message array.
  if (!empty($message['mailer']) && is_object($message['mailer'])) {
    if (!$message['mailer']
      ->Send()) {
      if ($logging == SMTP_LOGGING_ALL || $logging == SMTP_LOGGING_ERRORS) {
        watchdog('smtp', 'Error sending e-mail from @from to @to, will retry on cron run : !error_message.', array(
          '@from' => $message['from'],
          '@to' => $message['to'],
          '!error_message' => $message['mailer']->ErrorInfo,
        ), WATCHDOG_ERROR);
      }
    }
    return;
  }

  // Let the people know what is going on.
  if ($logging == SMTP_LOGGING_ALL) {
    watchdog('smtp', 'Sending mail to: @to', array(
      '@to' => $message['to'],
    ));
  }

  // Send the message.
  $mail_system = new SmtpMailSystem();
  $mail_system
    ->mailWithoutQueue($message);
}