1

I am very new with cron job.I have to make a cron job to send email after fetching data from the database with core php.I have checked the functionality in browser and it is working fine.But in cron job it is neither giving an error nor an output(mail).I have given my email in the specified area where they have mentioned to get the cron job errors.

I checked the cron job functionality other than mail.It is working fine.

I have used php mail() function to send the mail.Please help me to find what is wrong with the cron job to send mail.

I am trying to get the cron job in a shared godaddy linux server.

I have read the related topic and tried with that solutions too.no hope. Please help me to find what is wrong.

Thanks,

  • niyou ,I have checked the cron job functionality with php mail() function.That even is not working – user3149445 Jan 02 '14 at 10:53
  • after that i read this forum and tried to implement this way too http://stackoverflow.com/questions/19170524/how-to-send-email-from-godaddy-through-a-cron-job..this too giving an error like The server encountered an internal error or misconfiguration and was unable to complete your request. – user3149445 Jan 02 '14 at 10:56

1 Answers1

2

I was having a similar issue; I would be able to request the php script directly (un the url bar) and mail would send, and my cron jobs were running but I got no mail.

I did a bit of a work-around to solve this. I created another php file for the cron to run that simply makes an http request to the script that sends the mail. it isn't the most elegant, but it does seem to work.

     include_once('http.php');
     $r = new HttpRequest('http://example.com/scripts/mailing_script.php');

     try {
             $r->send();
         }
     catch (HttpException $ex) {
         echo $ex;
     }

"http.php" is a file i found here: https://gist.github.com/twslankard/989974

it effectively replaces php's HttpRequest which was giving me issues (see HttpRequest not found in php).

good luck, and I hope this helps

Community
  • 1
  • 1
GeorgeLambadas
  • 141
  • 1
  • 6