Magento Send Order method

Magento Send Order method

September 3, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento Send Order method

Solving the Magento Order Email Dilemma

Introduction

As a seasoned developer working with e-commerce platforms like Magento, I’ve often come across questions about sending order confirmation emails to customers after successful payment. If you’re facing challenges in finding the correct method or witnessing unexpected behavior when removing certain classes, this guide will help you navigate through the complexity and provide a clear solution.

Understanding the Magento Order Email System

Magento’s email system is quite robust but can sometimes be confusing due to its layered architecture. The sendNewOrderEmail() method you found in /app/code/core/Mage/Sales/Model/order.php is indeed responsible for sending new order emails using the default template and design.

However, your observation that removing this class doesn’t stop email delivery indicates that Magento has multiple paths for sending order emails, which can lead to some unexpected results during development.

The Correct Method: Using Event Observers

The core of Magento’s email system lies in the event observers. When an order is placed and the payment is successful (or even if it fails), Magento triggers events like sales_order_place_after or sales_order_payment_failed.

These events are caught by observer modules, which then trigger the actual email sending process. The Magento core has a default observer for sending new order emails located in /app/code/core/Mage/Sales/etc/config.xml:

<config>
  <global>
    <events>
      <sales_order_place_after>
        <observers>
          <new_order_email>
            <class>sales/order</class>
            <method>sendNewOrderEmail</method>
            <type>singleton</type>
          </new_order_email>
        </observers>
      </sales_order_place_after>
    </events>
  </global>
</config>

This configuration tells Magento to call the sendNewOrderEmail method from the Mage_Sales_Model_Order class whenever a new order is placed successfully.

The Right Send Mail Method

The correct way to send an email in this context is by using the event observer mechanism. When you need to override or extend the default behavior, create your own module and add an observer for the sales_order_place_after event.

Here’s a brief example of how you can create a custom observer:

class MyCompany_SalesOrder_Model_Observer
{
    public function sendCustomNewOrderEmail($observer)
    {
        $order = $observer->getEvent()->getOrder();
        Mage::getModel('core/email_template')->sendTransactional(
            'sales_email_order_new',
            'sales',
            $order->getCustomerEmail(),
            $order->getIncrementId(),
            array('order' => $order)
        );
    }
}

In this example, we create a new observer that sends an order confirmation email using the sales_email_order_new template.

Conclusion

While it may seem counterintuitive at first, Magento’s order email system is designed to be modular and extensible. Instead of relying solely on the sendNewOrderEmail() method in the core model, focus on the event observers that trigger this behavior.

By understanding the event-driven nature of Magento’s email system and creating custom observers, you can effectively control how and when order emails are sent without resorting to removing core classes or facing unexpected side effects during development.

For a more detailed guide on creating and configuring Magento events and observers, I recommend checking out our comprehensive tutorial at LaravelCompany.

Extensions Themes Configuration Email

Our network