more module updates

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-20 18:13:58 +02:00
parent 55b23a2cec
commit 2121a356b3
51 changed files with 1638 additions and 851 deletions

View File

@@ -61,3 +61,44 @@ function smtp_mail($key, &$message, $params) {
$message['body'] = $params['body'];
}
}
/**
* Implementation of hook_cron_queue_info().
*/
function smtp_cron_queue_info() {
$queues['smtp_send_queue'] = array(
'worker callback' => 'smtp_send_queue_runner',
'time' => 60, // This is the max run time per cron run in seconds.
);
return $queues;
}
/**
* smtp_send_queue queuer.
*/
function smtp_send_queue($mailerObj) {
$queue = DrupalQueue::get('smtp_send_queue');
$queue->createItem($mailerObj);
}
function smtp_send_queue_runner($variables) {
_smtp_mailer_send($variables);
}
function _smtp_mailer_send($variables) {
$mailer = $variables['mailer'];
$to = $variables['to'];
$from = $variables['from'];
// Let the people know what is going on.
watchdog('smtp', 'Sending mail to: @to', array('@to' => $to));
// Try to send e-mail. If it fails, set watchdog entry.
if (!$mailer->Send()) {
watchdog('smtp', 'Error sending e-mail from @from to @to : !error_message', array('@from' => $from, '@to' => $to, '!error_message' => $mailer->ErrorInfo), WATCHDOG_ERROR);
return FALSE;
}
$mailer->SmtpClose();
return TRUE;
}