We're working on importing orders from a legacy system into a Magento store.

We have a script that creates the customer if he doesn't exist and creates the order.

We want to make sure that no emails get sent out from Magento for any of these orders.

We initially setup our script as such


//Disable all emails
Mage::app()->getConfig()->saveConfig('system/smtp/disable', '1', 'default', 0);

//run import 

//Re-enable all emails
Mage::app()->getConfig()->saveConfig('system/smtp/disable', '0', 'default', 0);


We have two concerns with this approach

  1. If a customer places an order during the time that our script is running - they won't get a confirmation
  2. Since Magento now sends the emails through a queue and a cron, if our script is finished by time the cron runs, the emails will still get sent out.

What would be a better way to ensure that no emails get sent out as a result of our importing legacy orders?

  • 1
    It would be good to see the code which is creating the orders as there are a few different approaches. Commented Aug 28, 2017 at 17:41
  • Email sending should be disable during order creation ... want to share some code?
    – sv3n
    Commented Oct 31, 2018 at 19:20
  • @svn what are you asking?
    – Haim
    Commented Oct 31, 2018 at 23:51

1 Answer 1


If you have AOE_Scheduler installed, you can disable the email queue processing, prior to running your import script.


Then, after you have run your script, use the comma-separated entity_ids of the orders you created in the following MySQL query.

delete from core_email_queue
where entity_type = 'order'
    and entity_id in ('111','222','333');

This will remove the order emails from the queue. Then, you can re-enable the cron in AOE_Scheduler.

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.