2

Hello could anyone help me to resolve my order email problem, i am struggling with setting up cron job in hostgator, currently i am running on shared plan, as per hostgator, in shared service plans PHP version 5.4 is installed.

and i have installed Magento CE 1.9.1.0.

i have tried following two commends from the cpanel and scheduled it for 15 mins.

/opt/php55/bin/php -q /homedirectory/username/public_html/cron.php

/opt/php54/bin/php -q /homedirectory/username/public_html/cron.php

and i am not receiving order emails :(.

other than scheduling cron.php from magento, is there anything else i need to do in the magento itself inorder to receive emails? ( i have already enabled and setup "order email" in "Sales email" tab)

Also i confirm order emails are going in core_email_queue table.

Thank you in advance for any helps..

Helmey Hussain
  • 223
  • 2
  • 7
  • Does it work when you run the cron.php directly, like http://www.yoursite.com/cron.php? – seanbreeden Feb 07 '15 at 12:13
  • No it does not work, it opens a blank page, but the cron.php did not send the email. i also made sure is the cron.php is really called by the hosting schedules by renaming the cron.php file as cronnnn.php, then i received a email saying file cannot be open, so i am sure hosting is running the cron.php file as scheduled.. – Helmey Hussain Feb 07 '15 at 13:17
  • Create a php file called pi.php (or whatever) and run <?php phpinfo(); Check the disable_functions line to make sure mail isn't in there. If it is then you'll need to set up SMTP in Magento's admin. – seanbreeden Feb 07 '15 at 13:22
  • Have you contacted HostGator to see if they're intentionally blocking outgoing mail? I know some shared accounts will do this to prevent people from signing up to send spam. – seanbreeden Feb 07 '15 at 13:23
  • Ok i will try to do that, pi.php sould be the copy of cron.php? and regarding running <?php phpinfo() directly from the command prompt and checking diable_function, i need to figure out how to do, i am really new to this.., but anyway thank you for your comments, i will try your hints and then come back.. – Helmey Hussain Feb 07 '15 at 13:31
  • That's ok :) We all start somewhere. You can just upload the pi.php to your server and run it from a browser. It will output your php configuration. You can then search for the disable_function line to see if mail is in there. Shared hosting plans like HostGator will disable outgoing mail sometimes to protect themselves from spammers. – seanbreeden Feb 07 '15 at 13:43
  • In the disable_funtion i see following values disable_functions dl dl ( first dl is local value and second dl is master value) – Helmey Hussain Feb 07 '15 at 13:53
  • Some additional information, i have following values for this attributes sendmail_from no value no value sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i SMTP localhost localhost – Helmey Hussain Feb 07 '15 at 14:01
  • That's fine. Almost everyone has dl() disabled. There's an extension called Aoe_Scheduler that adds an admin page for viewing all of your scheduled cron jobs. You can use that to determine if your cron is running properly. Since mail() is not disabled and if outgoing mail isn't blocked then the next thing to check would be your e-mail queue. http://www.magentocommerce.com/magento-connect/aoe-scheduler.html – seanbreeden Feb 07 '15 at 14:04
  • Ok, i will install AOE_SCHEDULER, and in addition should i check with host gator that outgoing mail is not blocked? or disable_function doesn't have mail, which means that outgoing email is not blocked by hostgator? – Helmey Hussain Feb 07 '15 at 14:09
  • UPDATE: after installing AOE SCHEDULER, i see lot of SUCCESS status for CORE_EMAIL_QUEUE_SEND_ALL and very few PENDING status and no entries for CORE_EMAIL_QUEUE_CLEAN_UP – Helmey Hussain Feb 07 '15 at 14:49
  • Follow up with HostGator to make sure that they aren't blocking your outgoing mail. – seanbreeden Feb 07 '15 at 15:18
  • Hi,i checked with hostgator, they were sure that outgoing emails are not blocked, and moreover they ask me to check my email setup in magento and they are not seeing any email going out from the server, i have manually ran CORE_EMAIL_QUEUE_CLEAN_UP to flush the all emails from the queue.. but it does not clean the emails from the queue table, probably i will delete all the records manually and then re-check.. – Helmey Hussain Feb 07 '15 at 15:32
  • Cool Dude!!! finally i started receiving emails :), i just rechecked the emails in magento email settings, it was fine.. then i cleared all the emails form the queue.. and placed a new test orders.. then started receiving emails. Thank you so much for your help... – Helmey Hussain Feb 07 '15 at 16:08

1 Answers1

2

(Continued from the Question comments)

That sounds like a reasonable course of action to take. The consensus seems to be that something has to be wrong with your cron.

If clearing the queue doesn't make the e-mails start sending then there's a thread on here that I found that has some suggestions.

New order email confirmation not being sent

seanbreeden
  • 2,825
  • 18
  • 24
  • Yes i tried that before by removing the code which is sending the emails to the queue and emails start going on instant click instead of going into the queue... but i did not want to deviate from magneto way of sending emails. Installing AOE_SCHEDULER really helped to see the status and to run the job manually, etc. – Helmey Hussain Feb 07 '15 at 16:17
  • Agreed. It's always best to adhere to Magento standards. – seanbreeden Feb 07 '15 at 16:20
  • I have one wired guess, From the AOE schedule i can see this script core_email_queue_send_all is getting scheduled for every one minute inside the magento, can also check from the cron expression /1 * * , whereas from the server it could be actually /5 * * * * or /15 * * *, Probably this could be an issue? – Helmey Hussain Feb 07 '15 at 16:23