6

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?

Thanks

  • im facing same problem all email are going but when invoice create magento does not send email . I do see the emails in the core_email_queue and core_email_queue_recipients the processed_at times are all NULL cron.php file show blank when i hit it . I need help plz help here is my website:- edgynailsupply.com/index.php – Shivi Jul 7 '15 at 11:44
6

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.

This 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

1

I had the same problem like you before. I had to create a cron job in my hosting account c-panel. You have to make sure the command is correctly written, if not it won't work.

  • I've already created a cron job in cpanel and verified with a tech that is written correctly and running. – shakehurst Jan 12 '15 at 20:41
1

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:

  1. First of all make sure your settings are correct under system > configuration (mailadresses, sales settings)
  2. What often happens is that you use a payment with an external redirect URL. It happens that you have to define the mailsettings per payment.
  3. 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.

  • Thanks for the reply. As far as I can tell all my store email settings are correct. I am not having anything redirect to PayPal or any other checkout as the only options I give customers is to choose free shipping / pay later after I reply personally with an email containing more order details. Doing it this way has never been an issue before... Still baffled as to what's going on... – shakehurst Feb 22 '15 at 17:57
  • Ok strange. Did you try the logging / what was the output? Does it get into the if? If it doe, it probably creates the mail queue but your cron is not sending them. Also check these tables: core_email_queue´ and´core_email_queue_recipients', since the queue is stored in those tables. Do you see your order mails in this table? And try to fire you cron manually via yourdomein.com/cron.php (maybe enable display errors php constant in the cron file to find out if the script itself returns an error) – Marcel Feb 23 '15 at 8:46
  • I do see the emails in the core_email_queue and core_email_queue_recipients the processed_at times are all NULL @user2897757 – shakehurst Mar 2 '15 at 16:36
  • Ok, well if I were you I would focus on getting the schedule in you tables first. So start putting logs step by step in the Magento code. Make sure it reaches the code where the cron actually is scheduled to the DB. IMO would this be the best way to find out where it goes wrong. PS: see my initial answer for the file to start logging. – Marcel Mar 9 '15 at 13:03
  • @user2897757 hi, we are encountering the same problem as shakehurst. The cron job keep failing when sending the queue email. And system throwed an exception message 'Unable to send mail.' in ../lib/Zend/Mail/Transport/Sendmail.php:137. Next, instead waiting cron job to trigger, we tried execute the same command '/usr/local/bin/php cron.php' in CLI, 3 to 5 times. The email sent out successful intermittently. – Leongelis Mar 27 '15 at 2:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.