Month: October 2015

Magento Order email not sent but cron job running | exception ‘Zend_Mail_Transport_Exception’ with message ‘Missing To header’ in /var/www/html/shop/lib/Zend/Mail/Transport/Sendmail.php:182

Solution 1

Are you getting following message in your magento shop /var/exception.log

2015-10-28T00:05:02+00:00 ERR (3):
exception 'Zend_Mail_Transport_Exception' with message 'Missing To header' in /var/www/html/shop/lib/Zend/Mail/Transport/Sendmail.php:182
Stack trace:
#0 /var/www/html/shop/lib/Zend/Mail/Transport/Abstract.php(337): Zend_Mail_Transport_Sendmail->_prepareHeaders(Array)
#1 /var/www/html/shop/lib/Zend/Mail.php(1194): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
#2 /var/www/html/shop/app/code/core/Mage/Core/Model/Email/Queue.php(236): Zend_Mail->send()
#3 [internal function]: Mage_Core_Model_Email_Queue->send(Object(Mage_Cron_Model_Schedule))
#4 /var/www/html/shop/app/code/core/Mage/Cron/Model/Observer.php(326): call_user_func_array(Array, Array)
#5 /var/www/html/shop/app/code/core/Mage/Cron/Model/Observer.php(72): Mage_Cron_Model_Observer->_processJob(Object(Mage_Cron_Model_Schedule), Object(Mage_Core_Model_Config_Element))
#6 /var/www/html/shop/app/code/core/Mage/Core/Model/App.php(1357): Mage_Cron_Model_Observer->dispatch(Object(Varien_Event_Observer))
#7 /var/www/html/shop/app/code/core/Mage/Core/Model/App.php(1336): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Cron_Model_Observer), 'dispatch', Object(Varien_Event_Observer))
#8 /var/www/html/shop/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)
#9 /var/www/html/shop/cron.php(77): Mage::dispatchEvent('default')
#10 {main}
As you might understand that the problem is due to sender missing. But, in Magento 1.9, this is serious problem as it might stop all your order emails to stop sending. The solution is finding the order with the null email address and deleting the email_queue cron job of that order. Here are the tricks

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


DELETE FROM core_email_queue WHERE message_id='MESSAGE_ID_MISSING_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;

This should clear all your email queues but will delete the working email queues too.


Magento Cron jobs not running and no error: Flush Storage Cache

This is from post

Sometimes you can find the cron jobs for your Magento store just aren’t running, or are running intermittently even though everything has been setup correctly and there is apparently no reason for it.

Surprisingly you might find the problem is actually down to a simple caching issue with a one line code fix. Magento caches it’s cron schedule and reads this cached content on subsequent runs of cron rather than recreating the schedule each time to determine which jobs it should execute. The problem is sometimes jobs just don’t get cached despite them being configured correctly so when the time comes for them to execute nothing actually happens.

It’s worth noting that the cron schedule is cached even if all caching is disabled in admin, and the only way to clear the cached schedule through admin is to Flush Cache Storage under System->Cache Management. Unfortunately this doesn’t then cause the jobs to be correctly cached the next time cron is run.

So the fix is to simply disable the caching of the cron schedule, and don’t worry, benchmarks with caching disabled shows this to have no negative impact on site performance.

if it’s not already there. Open the copied file and find the following line inside the generate() method:
Mage::app()->saveCache(time(), self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT, array(‘crontab’), null);
This is the line that initiates caching of the cron schedule, so just comment it out:
//Mage::app()->saveCache(time(), self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT, array(‘crontab’), null);
Save the changes and Flush Cache Storage to clear any currently cached cron jobs and your store should now always execute properly configured cron jobs.

Google Facebook Twitter Unified social media Login in Magento

There are several paid as well as free extensions for social media login that allows you to login into magento shop. However, my idea is several options creates confusion for the user, therefore I want to use the most popular ones and that too FREE.

The first step is to download the extension. I am using the following extension

CedCommerce Social Login


Social Login Magento

After installing this extension in your magento store ( I am using magento 1.9.1), you need to obtain keys from each site

I will start with Google login First

Login into magento via gmail or Google account

Login with google in Magento

  1. Go to the
  2. Create a new project with any name
  3. In the sidebar under “APIs & auth”, select Credentials, and click the OAuth consent screen tab.
  4. Choose an Email Address, specify a Product Name, and click Save.
  5. Now in the sidebar under “APIs & auth”, select Credentials.
  6. Click on Add Credentials and select oauth2 clientID
  7. Select Web Application
  8. Fill up the details and click create
  9. In Authorized JavaScript origins enter your domain name like :
  10. In Authorized redirect URIs, enter the page location from where the account login will be called like:: OR OR
  11. You will get a Client ID and client secret. SAVE it in a notepad
  12. Now login into your magento shop backend and go in  SYSTEM -> CONFIGURATION ->CEDCOMMERCE EXTENSION->SOCIAL LOGIN
  13. Use these credentials in Social Login Google Options
  14. Give 5-10 mins for google server to update your details
  15. Now go to your magento frontend and try to login via google plus

I used the following link as guide


Login into magento via facebook account

Login with facebook in MagentoLogin with facebook in Magento

  1. First step is go to
  2. Click on add a new app and select website
  3. Name the project and click on the app
  4. Add the website URL
  5. Now click on Finish
  6. Go again to
  7. Select your app
  8. Copy the App ID & App secret. You need to enter your password to get the app secret.
  9. Copy the details and paste it to your magento backend (SYSTEM -> CONFIGURATION ->CEDCOMMERCE EXTENSION->SOCIAL LOGIN->FACEBOOK)
  10. Give 5-10 mins for google server to update your details
  11. Now go to your magento frontend and try to login via facebook
  12. Sometimes in facebook you need to submit an application and get approval to make this thing work. All these things can be managed from facebook apps page



Login into magento via Twitter account

Login Via twitter to Magento Login Via twitter to Magento Login Via twitter to Magento

  1. First step is go to
  2. Create a new app
  3. Fill in the details like domain name , description, website and call back url
  4. Click save
  5. Now copy the Consumer Key (API Key) Consumer secret to your magento backend (SYSTEM -> CONFIGURATION ->CEDCOMMERCE EXTENSION->SOCIAL LOGIN->TWITTER)
  6. Now go to your magento frontend and try to login via twitter