I'm using what I learned over at https://stackoverflow.com/a/3176517/ to route mail()-commands in PHP on my local machine to a file. From the php.ini:
sendmail_path ='tee /testmail/mail.txt'
But when I add an additional_parameter (-fwebmaster@example.com) it generates an addtional file named -fwebmaster@example.com with the content of the mail in the current folder.
A complete example:
$ cat | php -d sendmail_path='tee /testmail/mail.txt'
<?php
mail('test@example.com', 'subject', 'body', '', '-fwebmaster@example.com');
?>
To: test@example.com
Subject: subject
body
The last five lines are written to /testmail/mail.txt and and newly created -fwebmaster@example.com.
It seems that the -f-parameter gets forwarded to the tee-command. Is there a way to prevent that?
(Using cat results in an error and PHP returns false.)