Is it possible not to use the cron jobs to send my sales confirmation email? I am on a shared hosting with hostgator and they don't allow cron jobs to be less than every 15 minutes. I don't want my customer to see an order confirmation after 10 or 15 minutes. IS there a way to change this?
-
2I see no reason on why they should put such archaic limit in place. One better way is to consider another provider who allows you to set a shorter interval for your Cron Jobs.– Aspiration HostingCommented Jan 11, 2015 at 0:11
-
Shared hosting really isn't cut out for Magento, whatever the hosting provider might tell you - would really recommend you upgrade to VPS or better.– Jonathan HusseyCommented Jan 11, 2015 at 7:37
-
Thankyou for the suggestion– James TsaiCommented Jan 11, 2015 at 20:14
2 Answers
Well, if you don't want to jump hosts, just set up multiple entries in crontab which do the same thing and are offset by the frequency you want the mail sent out.
But, really, this is an indication of a host which is not well-suited for Magento.
-
This might sound stupid but do you mean in my hostgator cpanel - cron jobs? or in my cron.php file? Commented Jan 11, 2015 at 20:16
-
I went to my hostgator cpanel and offset the time to */15+5 in the minute, it says "Cron field not formatted correctly." Commented Jan 12, 2015 at 5:23
-
If you want Magento cron executed every 5 minutes, then (given the 15 minute limitation) you can try
0,5,10,15,20,25,30,35,40,45,50,55 * * * *
. Or you can specify each entry individually if that doesn't work.– benmarksCommented Jan 13, 2015 at 0:03 -
Cool! I did one job with */15 (every 0, 15, 30 and 45). Made a second one with 5,20,35,50 and a third one with 10,25,40 and 55. Everything works! so far so good, they have not removed it yet! Thanks for the tip Commented Jan 13, 2015 at 23:29
I'ts possible to achieve that by modifying the Magento Core.
In the class Mage_Core_Model_Email_Template you can find the method send(...)
in around line 371, and inside this method, find this line:
$subject = $this->getProcessedTemplateSubject($variables);
in my version its in line 392, there you can catch the content of the email in $text and the $subject, and send the email using PHP's mail() function. I admit that this is not a clean way to do that, but this will fix the issue.