Drupal allows an administrator to 'run cron manually' from the Status report page (admin/logs/status). If you have mail in the active queue when you 'run cron manually', this mail will not be sent. Instead, this mail is re-queued so that there are then 2 copies of each mail item in the active queue.

Comments

Michael Phipps’s picture

I develop on a local machine first, and so ran into the same problem. I've looked into this a little bit, and the way that the module tests to see if it is being run by cron is flawed. It tests to see if a particular filename is in the path.

I've been working on a fix for this, but I have no idea how to submit patches.

Basically, to fix the problem, I've set a variable called $is_cron_running in the mailq_cron(). Then I've modified the druapl_mail_wrapper so that it checks the value of that variable to see if cron is running before modifying the mail task to a queing task.

My local setup does not have a functioning mail server, so I need to test this on another machine before I feel confident it is working correctly.

If I can work out how to patch things - I'll submit something.

Michael Phipps’s picture

Actually - I think my way of approaching things is a little flawed, and I've realised the if statement containing the test to see if cron was running wasn't the best it could be. Rather than using another variable to track this, try this codesnippet:

if ($_GET['q'] == 'admin/logs/status/run-cron' || $_SERVER['REQUEST_URI'] == '/cron.php')

zyxware’s picture

@InternetPro - Thanks for the suggestion. This fix has been made in the 6.x version of the module. I am marking this 5.x issue as wont-fix.

zyxware’s picture

Status: Active » Closed (won't fix)

Marking this 5.x issue as wont-fix.