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("firstname.lastname@example.org", "TEST", $string, "From: email@example.com");
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.