I have verified that the cron script is running, but order confirmation emails are not being sent out. When I open cron.php I see nothing in there regarding emails. Do I need to add anything to the file to make it send the emails?
I have the same problem in my couple of sites in recent past.
As in the latest magento version, magento has introduce new feature of processing the order confirmation email in a queue, so we must have to configure cron.php to call every 5 minutes in order to make this scheduled task work properly.
cron.php file indirectly calls the
cron.sh file which you will find in the
webroot directory of your magento site.
I was facing this issue because of the hosting providers,I was hosting these sites on the shared hosting service before therefore I have contacted them for this issue.
In the case of first site the issue was with the hosting provides itself, they are not allowing to run the commands which are in the
cron.sh because it is shared hosting.
In the second case, they are executing the cron.php file but the time interval was every 20 minute and due to this circumstances magento is not able to execute this file properly and the order confirmations emails are not being sent.
So, finally the only solution for me was to change the hosting plan, I have moved both the sites to the
dedicated/VPN hosting and now it is working quite smoothly.
I hope, my points would useful to geeks
The cron.php code should be fine, you won`t find any mail action code in there. It is just a cron to process the queue. Since Magento 1.9 all sale e-mail messages are added to a queue and sent via cron.
I have had mailproblems before and there are a few things to check out in order to fix this:
If this does not solve anything I would suggest you browse to the file 'mage/checkout/model/type/onepage.php' on your server. There search for the function 'queueNewOrderEmail', this has to queue the mail after creating a new order. You can easily check if Magento ever gets to this code by adding this line before the function call:
Mage::log('Log before function call queueNewOrderEmail');
If I remember correctly this function call is nested in an if statement. That if statement checks for a redirecftUrl and order flag. Adding a extra log with this values will give you more information about why it is or is not getting into the If statement:
Mage::log('Redirect value: '.$redirectUrl . ' Order flag ' . $order->getCanSendNewEmailFlag());
Please note that I have not tested this last log, maybe the variable names or the if statement is changed in 1.9.