Done that, and there is nothing wrong with the function.
How did you inspect the contents of the buffer to determine whether the function did what you asked?
If you simply echo the results to the screen, the <whatever@tag> stuff will NOT be displayed because your Web browser considers them to be (unrecognized) HTML markup tags and ignores them.
In the following example, the header() function tells your Web browser to examine the results as plain text.
<?
$filename = "mail.txt";
$fp = fopen($filename, "r");
$buf = fread($fp, 4096);
fclose($fp);
header("Content-type: text/plain");
echo($buf);
?>
Point this at any saved email text file and you will see the entire set of email headers (everything up to 4K), including addresses enclosed in angle brackets.