Hi to all!
I have used the following php file for testing cron job at my server. which will send email only on a specific time. here is the code of the file:
<?php
$mailto = "nilanjana@k****ij.com,
sujata_atkcs@yahoo.com";
$subject = "Cron email testing";
$header = $header."From: ".sujata."\n";
$body = "Information\n";
$body = $body."-----------\n";
mail($mailto,$subject,$body,$header);
?>
file is working perfectly when i execute it on the browser. but not working from crontab.
file is there but when the time of execution its sending me a mail with following matter written on it:
/home/httpd/vhosts/k****ij.com/httpdocs/php/cronmail.php: line 1:
?php: No such file or directory
/home/httpd/vhosts/k****ij.com/httpdocs/php/cronmail.php: line 2: =:
command not found
/home/httpd/vhosts/k****ij.com/httpdocs/php/cronmail.php: line 3: =:
command not found
/home/httpd/vhosts/k****ij.com/httpdocs/php/cronmail.php: line 4: =:
command not found
/home/httpd/vhosts/k****ij.com/httpdocs/php/cronmail.php: line 6: =:
command not found
/home/httpd/vhosts/k****ij.com/httpdocs/php/cronmail.php: line 7: =:
command not found
/home/httpd/vhosts/k****ij.com/httpdocs/php/cronmail.php: line 9:
syntax error near unexpected token `$mailto,$subject,$body,$header'
/home/httpd/vhosts/k****ij.com/httpdocs/php/cronmail.php: line 9:
`mail($mailto,$subject,$body,$header);'
cron tab setting is as follows:
everyday at 14.00 hours the following file will be executed with following path
/home/httpd/vhosts/k****ij.com/httpdocs/php/cronmail.php
can anyone tell me where i have made mistake? i am testing it first time. if this script using corn work well i will implement more task using this.
any help will be highly appreciated.
Thanks!