0

I probably run into this issue once every other month. We inherit a website from a client that is all up to date on its patches (1.9.1 and up), but cron was never set up. As soon as we set up cron, a years' worth of customers suddenly get emails about their (long fulfilled) orders, and then proceed to freak out calling about why they are being "double charged" for a product they purchased a year ago.

What's happening is once that cron job goes live, it runs the core_email_queue_send_all function, cleaning out it's massive backlog of Magento emails, then it runs the core_email_queue_clean_up function to empty out the queue.

Is there any way to manually bypass the core_email_queue_send_all function and only run the core_email_queue_clean_up function so that our clients don't suddenly get a million angry phone calls from confused customers? We want all clients going forward to get the proper emails, but it doesn't make sense to email people who have already gotten their products.

3 Answers 3

3

You could use magerun sys:cron:run to execute only one cronjob command. For more info click here

1

You can use AOE Scheduler to perform cron job

https://www.magentocommerce.com/magento-connect/aoe-scheduler.html

This module allows you to manage your scheduler tasks.

0

To me, this is an XY problem. I don't think that messing with events or cron functionality is the best way to solve it.

My recommendation is to simply truncate the core_email_queue_recipients and core_email_queue tables before setting up the cron. This will ensure that none of those emails get sent out.

In my experience, this won't cause any issues. We do it all the time after copying a production database back to a development environment, to ensure that the dev server doesn't go sending out a bunch of emails [which were already sent by the prod server].

Speaking specifically to your idea of triggering core_email_queue_clean_up: That won't do what you want. That event just calls removeSentMessages() which will only delete the entries WHERE processed_at IS NOT NULL. You are needing to delete even unprocessed rows, so the other answers (1, 2), while factually correct, won't actually solve your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.