I have a text file called "basic.txt" with the following text
$string = "";
$file = fopen("basic.txt", "r");
$string .= file_get_contents("basic.txt");
echo $string; // this is to test that in fact $string contains the text and it does
mail("email@example.com", "TEST", $string, "From: firstname.lastname@example.org");
Get rid of these 2 lines:
$file = fopen("basic.txt", "r"); $fclose($file);
Since you're already using
file_get_contents() which fetches the file's content.
Running your code from my server produced:
Fatal error: Function name must be a string in /path/to/file.php on line 5
Your code is failing on you silently.
Therefore and in the OP's case and as per suggestions in comments, a full system path was required for the text file, and had to setup a new cron job.