$file = file_get_contents("text.inc"); $start = "[start]"; $end = "[/end]"; $pos_start = strpos ($file, $start); $pos_end = strpos ($file, $end); $data = substr ($file, $pos_start, $pos_end); mail ("[EMAIL PROTECTED]", "My Subject", $data);
This code works when I call it from browser, but when I call it from command line, $data is not put into mail (mail is send but it is empty, without any data in body). File text.inc looks like this: [start]some_text_goes_here[/end] [other_start]other_text_goes_here[/other_end] Regards.