Email Piping PHP

Job ID: 33088040

Budget: £10 – £20 GBP

I need a script coded for PHP to "email pipe" emails to WHMCS.

My hosting provider has given me this sample code, but no idea how to run it etc.


#!/usr/bin/php -q
<?php
$email_msg = ''; // the content of the email that is being piped
$email_addr = 'you(at)yourdomain.com'; // where the email will be sent
$subject = 'Piped:'; // the subject of the email being sent

// open a handle to the email
$fh = fopen("php://stdin", "r");

// read through the email until the end
while (!feof($fh)){
$email_msg .= fread($fh, 1024);
}
fclose($fh);

// send a copy of the email to your account
mail($email_addr, $subject, "Piped Email: ".$email_msg);
?>
Related categories: PHP Software Architecture MySQL HTML WHMCS