During a Magento migration some issues can arise, one of them being notification emails to both admin and users stop being sent. Apparently this is a tricky one for alot of people to find a solution for. Here is my fix, hopefully it prevents someone from repeatedly smashing their face against a wall =)
By default Magento has a decent set of default functionality for cron jobs setup. One thing than can happen during an upgrade is the magento mail que will stop communicating with server.
NOTE: Older versions of Magento send notification emails instantly, Magento 1.9.x stores the email notifications in the database table “core_email_queue” so check here if you want to see if the table is full, if it is you may have a cron issue.
1. The first thing to check is your CPANEL -> CRON JOBS section see if there is anything already setup.
2. Check Magento cron file is typically in the Magento Root
3. In the CPANEL -> CRON JOBS section add in
Here is the full code sample:
*/15 * * * * curl -s -o /dev/null http://www.mywebsite.com/path/to/magento/cron.php
IN CPANEL CRON TAB THE ABOVE CODE IS BROKEN DOWN INTO INPUT FORM DATA
*/15 in the ‘minute’ field
* is the ‘hour’ field
* is the ‘day’ field
* is the ‘month’ field
* is the ‘weekday’ field
curl -s -o /dev/null http://www.mywebsite.com/path/to/magento/cron.php in the command field.
This should enable Magento the ability to send out the mail that is stored in the que.
Remember if you want to test the cron job you can enter in an email address in cpanel after testing to stop cron email spam.
Use a special cron management Magento extension AOE SCHEDULER – This plugin should be included in the Magento Core by default, that is how awesome this extention is!
This will show all cron tabs in Magento and allow you to see what is being processed and what’s not.
If there is a problem with the heartbeat cron job then you are on the right track…it is a cron issue not setup properly.
NOTE: for some configurations adding 1 piece of code to magento cron.php
<code> $isShellDisabled = (stripos(PHP_OS, ‘win’) === false) ? $isShellDisabled : true; </code>
<code> $isShellDisabled = true; </code>
Go back through CLI or CPANEL CRON TAB and make sure you are running “*/5 * * * * php -q path/to/magento/cron.php”
GO BACK TO AOE SCHEDULER IN MAGENTO –
select the core_email_queue_send_all cron task and select RUN from the drop and then submit
Go back to phpmyadmin or sqli and look up your `core_email_queue` database table, which should be empty meaning the email sent.
Go back to AOE Scheduler and look at the visual timeline to see if all the cron jobs are processing correctly.
STILL GETTING ERRORS: If you see errors about cron jobs timing out in AOE Scheduler like the sample error below, adjust your cron settings in magento
Message: exception ‘Mage_Core_Exception’ with message ‘Too late for the schedule.’ in /home/path/to/shop/app/Mage.php:595
RE-ADJUST MAGENTO CRON SETTINGS:
If the cronjob runs every 5 minutes, try this configuration:
Generate Schedules Every 5
(enter here the cronjob execution time, in this case 5 minutes)
Schedule Ahead for 125
(based on cronjob execution time plus the maximum time one job needs. For example: sitemap xml takes 120 minutes, then enter 120 minutes + 5 = 125 minutes)
Missed if Not Run Within 180
(rumtime of the longest process, for example: an import takes 120 minutes, then enter 120 minutes + 60 minutes – because sometimes there is a difference between mysql and server time)
History Cleanup Every 10
(minimum cronjob execution time = 5 * 2 = 10 minutes in this case)
Success History Lifetime 1440
(duration of cronjob storage, to prove if everything works fine. 1440 = 24 hours)
Failure History Lifetime 1440
(duration of cronjob storage, to prove if there are any errors. 1440 = 24 hours)