Simple code to allow you to pipe an email to PHP using Forwarder setup with cPanel. You can use by setting up a new Forwarder and using Advanced options.
To pipe you will need to enter this in the box requires changing the root to your PHP file.
#!/usr/bin/php -q
// read from stdin
$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd)) {
$email .= fread($fd, 1024);
}
$lines = explode("\n", $email);
$myFile = "contentsOfMail.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $email);
fclose($fh);
?>