Showing results for 
Search instead for 
Did you mean: 

Order confirmation email not sending


Order confirmation email not sending

Running Magento 1.9.1


I have AOE Scheduleer installed, all crons are running correctly.


The sending of the emails is failing. The core_email_queue and core_email_queue_recipients tables are populated with the correct info. The processed_at time for all queued emails is NULL.


I'm getting the following exception in my log files

2015-07-10T13:55:02+00:00 ERR (3):
exception 'Zend_Mail_Transport_Exception' with message 'Missing To header' in /domains/domain_name/http/lib/Zend/Mail/Transport/Sendmail.php:182
Stack trace:
#0 /domains/domain_name/http/lib/Zend/Mail/Transport/Abstract.php(337): Zend_Mail_Transport_Sendmail->_prepareHeaders(Array)
#1 /domains/domain_name/http/lib/Zend/Mail.php(1194): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
#2 /domains/domain_name/http/app/code/core/Mage/Core/Model/Email/Queue.php(251): Zend_Mail->send()#3 [internal function]: Mage_Core_Model_Email_Queue->send(Object(Aoe_Scheduler_Model_Schedule))
#4 /domains/domain_name/http/app/code/community/Aoe/Scheduler/Model/Schedule.php(163): call_user_func_array(Array, Array)
#5 /domains/domain_name/http/app/code/community/Aoe/Scheduler/Model/Schedule.php(541): Aoe_Scheduler_Model_Schedule->runNow(true)
#6 /domains/domain_name/http/app/code/community/Aoe/Scheduler/Model/Observer.php(39): Aoe_Scheduler_Model_Schedule->process()
#7 /domains/domain_name/http/app/code/core/Mage/Core/Model/App.php(1338): Aoe_Scheduler_Model_Observer->dispatch(Object(Varien_Event_Observer))
#8 /domains/domain_name/http/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Aoe_Scheduler_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#9 /domains/domain_name/http/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#10 /domains/domain_name/http/cron.php(76): Mage::dispatchEvent('default')
#11 {main}


I have traced this to Mage/Core/Model/Email/Queue.php line 191

the following method collection returns nothing, despite the database containing the correct data

/** @var $collection Mage_Core_Model_Resource_Email_Queue_Collection */
$collection = Mage::getModel('core/email_queue')->getCollection()

 ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
 ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
 Mage::log('Collection '.$collection, null, 'mailLog.log');

/** @var $message Mage_Core_Model_Email_Queue */
 foreach ($collection as $message) {
       // set email details here


Has anybody else come accross this, any ideas how to fix it?


Thanks, Richie



Re: Order confirmation email not sending

IS this happening on all your emails or just order Confirmation? Have you tried using the default template as a test to see if that works?

Magento Moderator since 2009
Keep Calm and Clear Cache!

Re: Order confirmation email not sending

Just orders and order updates.

Invoice, shipment emails are sending fine.


I'm using the default Magento templates for all order, invoice, shipment emails.


Thanks, Richie

Re: Order confirmation email not sending

Fixed this issue.


It wasn't a problem with Magento but with our data. 


Upon going live we had removed all test data and transactions, however I'd missed an entry in the core_email_queue. There was no corresponding entry in core_email_queue_recipients, therefore this email could not be sent and stopped all others being processed. Removed this entry and everything is fine.



Re: Order confirmation email not sending


First find the order that have no email with following command

 FROM `sales_flat_order`
 WHERE `customer_email` IS NULL

Now I recommend to update that order

UPDATE `sales_flat_order` SET `customer_email` = '*******' WHERE `sales_flat_order`.`entity_id` =YOUR_ORDER_ID ;

Now find this order in core_email_queue

select * from `core_email_queue` WHERE entity_id='YOUR_ORDER_ID'; ///Note this is not order number. 
////you can get order id from the url of admin of order

There should be 2 entries if you send yourself as well order copy

And now find the corresponding in core_email_queue_recipients

select * from `core_email_queue_recipients` WHERE message_id='MESSAGE_ID_FROM_core_email_queue'
select * from `core_email_queue_recipients` WHERE message_id='MESSAGE_ID_FROM_core_email_queue'

If you do not have message_id in core_email_queue_recipients, then you should delete it from core_email_queue

Solution 2: Quick & Dirty one

Other quick and dirty solution which I have not tried, but you can try on test server first is to

TRUNCATE core_email_queue_recipients;
TRUNCATE core_email_queue;