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 -
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.');
}
}
Comments
Comment #1
caiosba commentedAttaching a working patch for this issue.
Comment #2
wundo commentedPatch failed at 0001 Fix from and support queue
Caio could you please re-roll against 6.x-1.x?
Comment #3
caiosba commentedSure. Please consider the attached one.
Comment #4
wundo commentederror: patch failed: smtp.module:390
error: smtp.module: patch does not apply
---
Sorry Caio, but it's still not applying could you re-roll again? I promise to review it faster this time!
Comment #5
caiosba commentedNo problem... updated patch attached :-)
Comment #6
wundo commentedWhat happens when smtp_mail_send's $mail->Send() fails?
Comment #7
wundo commentedPushed caiosba's commit for Drupal 6 branch.
Committed my own code for Drupal 7.