I am trying to set up a script to send out daily emails to my admin to let them know what went out of stock that day only.

It doesn't need to be anything fancy, perhaps even writing items to a text file as products go out of stock until the end of a day when that text files is sent out as an email and cleared for the next day?


  • 1
    Did you find an answer here? If yes, please mark it as solution. Commented May 8, 2013 at 14:09

4 Answers 4


Aside from the built-in RSS feed, there are two ways to actually send yourself an email - the actual answer to your actual question:

Purchase an extension:

I have no experience with this extension, but was mentioned on a StackOverflow:


Do it yourself:

Create an observer for cataloginventory/stock_item - on the save event. All models have save events provided by Mage_Core_Model_Abstract. On save, it will call your observer, you can examine the stock level at that point.




class MyCompany_MyModule_Model_Observer
    public function lowStockReport($observer)
        $event = $observer->getEvent();
        $stockItem = $event->getItem();

        if($stockItem->getQty() < $stockItem->getNotifyStockQty()){

            //stock is lower than the notify amount, send email

            $product = Mage::getModel('catalog/product')->load($stockItem->getProductId());

            $body = "{$product->getName()} :: {$product->getSku()} just Ran out of stock:\n\n";
            $body .= "Current Qty: {$stockItem->getQty()}\n";
            $body .= "Low Stock Date: {$stockItem->getLowStockDate()}\n";

            $mail = new Zend_Mail();
            $mail->setFrom('[email protected]', 'Low Stock Notifier');
            $mail->addTo('[email protected]', 'Your Name Here');
            $mail->setSubject('[Notice] An Item Has Gone Out of Stock');

This sends an email every time a stock item model is saved and the quantity on-hand is lower than the notify quantity set in Admin > Catalog > Manage Products.

Hope that helps.

  • 2
    The DIY route here is on the right track. The OP asked for a single email per night though, so I would suggest a table with 'product_id', 'timestamp', and 'notified' columns. When a product goes out of stock add an entry, when it comes back, remove the entry. Nightly you send an email for all un-notified and set the flag. That keeps you from notifying multiple times for each product, but you do get notification the next time the product goes out of stock. Commented May 28, 2013 at 13:25
  • 1
    Unfortunately, the cataloginventory_stock_item_save_after event is not triggered on purchase, at least in recent Magento versions. See here for alternative solutions: magento.stackexchange.com/questions/25207/… Commented Sep 18, 2015 at 11:53
  • One minor change to the wonderful explanation of @philwinkle Instead of: $stockItem = $observer->getEvent() use: $stockItem = $observer->getEvent() –getItem()
    – diazwatson
    Commented Jan 16, 2016 at 1:06

Old question, however I don't feel like it was ever really answered. I would add a and cronjob to the config.xml file in a custom module, figure out which products would need to be on the e-mail by building the collection (as below), then email the results.

    $date = strtotime('yesterday');

    $collection = Mage::getModel('cataloginventory/stock_item')
    ->addFieldToFilter('backorders', 0) 
    ->addFieldToFilter('is_in_stock', 0) 
    ->addFieldToFilter('manage_stock', 1) 
    ->addFieldToFilter('low_stock_date', array('date' => true, 'from' => date("Y-m-d", $date)))

While not an Out of Stock alert, Magento ships with a low stock RSS feed which might suit your needs.

Low Stock RSS Feed

  • how can i get downloadable report, rss just see the report
    – Gem
    Commented Nov 19, 2016 at 12:35

You could just use the native RSS feed for inventory - run a diff against the previous day's stock (ie. to find what changed only) - then fire off an email based on the result.

It would be a super simple ~10 line PHP script.

If you want something more sophisticated as a proper extension, then you'll need to add an observer to the order_save or stock index - to be able to capture then a value goes below 0 - and create a summary based on those values.

  • I do not have the experience unfortunately to build this but if you do, would you be interested in a fee for your services? My client would really benefit from it.
    – Adam Ross
    Commented Apr 1, 2013 at 13:39

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.