Emails not being sent from Magento (v1.9)

First, check if you have an error_log file in you public_html folder. If you have and it contains errors every minute (or however frequently you have your cron task set) regarding undefined PHP indexes for SCRIPT_NAME or SCRIPT_FILE_NAME, the following may fix the issue.

Make sure your cron command in cPanel or if you're ok with ssh, via the crontab -e command, is as below

* * * * * /bin/sh /home/YOURUSERNAME/public_html/cron.sh > /dev/null

In order for it to work properly, cron.php has two required changes. In your favourite text editor comment out/remove the lines

$_SERVER['SCRIPT_NAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_NAME']);
$_SERVER['SCRIPT_FILENAME'] = str_replace(basename(__FILE__), 'index.php', $_SERVER['SCRIPT_FILENAME']);

add

$_SERVER['SCRIPT_NAME'] = "cron.php";
$_SERVER['SCRIPT_FILENAME'] = "cron.php";

after

$disabledFuncs = array_map('trim', explode(',', strtolower(ini_get('disable_functions'))));
$isShellDisabled = is_array($disabledFuncs) ? in_array('shell_exec', $disabledFuncs) : true;
$isShellDisabled = (stripos(PHP_OS, 'win') === false) ? $isShellDisabled : true;

add

$isShellDisabled = true;

Magento upgrades may overwrite the cron.php file so you may have to make this edit each time you upgrade.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Installing Magento

We've installed it for a number of clients on our 'dingo' server which has all the system...

Using Web Server Rewrites

Magento can use more human looking and search engine friendly addresses for it's pages if you...

Emails not being sent from Magento

If you're not receiving emails from Magento - eg. from the 'Forgotten your password' link in the...

Magento Connect Downloader gives Internal Server Error

There's a bug in Magento's downloader which sets the file permissions to files it has installed...

Magento v1.1 says pdo_mysql not installed

Please delete the php.ini that gets installed with v1.1. This overrides the system php.ini which...