Posted by jersu on June 18, 2009 at 8:22pm
| Project: | SMTP Authentication Support |
| Version: | 6.x-1.0-beta3 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
I find that hitting 'submit' on pages that send mail via smtp take a long time for the request to complete, especially if more than one mail is being sent behind the scenes. I've slightly modified my smtp.module to take advantage of the cron queuing interface of the popular job_queue.module (actually, this function is pretty much lifted straight from queue_mail.module)
1) rename smtp.module function 'drupal_mail_wrapper' to 'smtp_mail_send'
2) add the following function -
<?php
function drupal_mail_wrapper($message) {
if (function_exists('job_queue_add')) {
job_queue_add('smtp_mail_send', t('Queued email'), array($message));
return t('Email message queued for delivery.');
}
else {
smtp_mail_send($message);
return t('Queuing unavailable. Email sent directly.');
}
}
?>