1
votes

I try to create a cron job in my hosting on godaddy but this cron didn't send any email yet.

that how i did the cron job:

1-login into my account in godaddy.com

2-go to cpanel

3-enter in cron job

4-on add new cron job Common Settings i select each minute

5-Command:i put like this: /usr/local/bin/php -q/home/username/public_html/testcron.php

The code in testcron.php this is:

$to="email address";
$from="[email protected]";
$subject='Testing Cron';
$message='<h2>Cron is working remove test cron job now.</h2>';
$headers="From:$from\n";
$headers .="MINE-Version:1.0\n";
$headers .="Content-type:text/html;charset=iso-8859-1\n";
mail($to,$subject,$message,$headers);

I test this page alone without a cron i receive an email in my junk folder

also i tired to write the Command like this: home/username/public_html/testcron.php

The problem that i didn't receive any email. Any suggestion to solve this problem ?!!

enter image description here

2

2 Answers

0
votes

Did you try running your command (usr/local/bin/php -q/home/username/public_html/testcron.php) from the terminal? There doesn't seem to be anything wrong with what you're doing ( except for that there's no space between -q and /home in your command)

0
votes

cron

"At every minute"

Minute  Hour  Day  Month  Weekday  Command  

1       *     *    *      *        php /home/username/public_html/testcron.php

Reload a page once in 5 minutes in background