I want to stop magento sending new order email in some cases.
I want to know from the community how to debug and backtrace the function that really send the order email confirmation email.
I've this event :
<sales_order_place_after>
<observers>
<xx_yy_Model_sales_observer>
<type>singleton</type>
<class>xx_yy_Model_Sales_Observer</class>
<method>save_order</method>
</xx_yy_Model_sales_observer>
</observers>
</sales_order_place_after>
And in my save_order function i do this :
try{
$order->setEmailSent(1);
$order->setStatus("holded");
$order->save();
}
catch(exception $e){
Mage::log('Non inoltra ordine', 1,'orders.log');
Mage::log($e->getMessage(),1,'orders.log');
}
But i still receive the new email order. I'm trying to debug core_email_template_mailer and core_email_template but seems that the email is not sent from there.
any help could be appreciated!!