Here's my PHP script that I use for the intercept:
#!/usr/local/bin/php -q
<?php
//Listen to incoming e-mails
$sock = fopen("php://stdin", 'r');
$email = '';
//Read e-mail into buffer
while (!feof($sock))
{
$email .= fread($sock, 1024);
}
//Close socket
fclose($sock);
emailPoster('email@address.com', "message");
function emailPoster( $to, $email )
{
$subject = "Email Intercepted";
$body = $message;
$headers = "To: {$to}
";
$headers .= "From: noreply@example.com
";
$headers .= "Subject: {$subject}
";
$headers .= "Reply-To: noreply@example.com
";
$headers .= "Return-Path: noreply@example.com
";
$headers .= "MIME-Version: 1.0
";
$headers .= "Date: " . date("r") . "
";
$headers .= "Content-Type: text/html; charset=ISO-8859-1
";
$sender = '-fnoreply@example.com';
if (mail($to, $subject, $body, $headers, $sender) ){
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
}
?>
and the pipe command I use in cPanel:
usr/local/bin/php -q /public_html/[mywebsite]/email/intercept.php
When I send an email to the appropriate address, it does process the intercept.php script, but it also returns a bounceback error.
Any ideas?