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

caiosba’s picture

Status: Active » Needs review
StatusFileSize
new2.57 KB

Attaching a working patch for this issue.

wundo’s picture

Version: 6.x-1.0-beta3 » 6.x-1.x-dev
Status: Needs review » Needs work

Patch failed at 0001 Fix from and support queue

Caio could you please re-roll against 6.x-1.x?

caiosba’s picture

Status: Needs work » Needs review
StatusFileSize
new2.5 KB

Sure. Please consider the attached one.

wundo’s picture

Status: Needs review » Needs work

error: 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!

caiosba’s picture

Status: Needs work » Needs review
StatusFileSize
new1.91 KB

No problem... updated patch attached :-)

wundo’s picture

What happens when smtp_mail_send's $mail->Send() fails?

wundo’s picture

Status: Closed (fixed) » Fixed

Pushed caiosba's commit for Drupal 6 branch.
Committed my own code for Drupal 7.

Status: Needs review » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.