- Edited
Could be generated by whatever makes the email...
You likely have to have the proper file name for the web server to serve the right content type... two options, one is to associate the extension with the proper mime type, the other would be to detect the file name and rename it. Hard for me to guess when I can't see the message. You can probably run the pipe.php from a command shell to debug it - that would allow you to echo some debug information - or you could use the error_log function to throw it to a tmp file...
Something like:
error_log(print_r($someobject,TRUE)."\n",3,'/tmp/yourlog.txt');
Should help you understand what you are getting... the output will tell you more about the structure of the variable you dump to the log while the program runs.