D
Deleted member 878571
Guest
I've set up an email forwarder in cPanel which pipes any incoming email to pipe.php. The email then gets forwarded to a different email ([email protected] for example) via pipe.php. In the future, I'll have DB calls determining where the email should be forwarded to, based on the sender etc...
But at the moment I'm just trying to set up the forwarder properly.
The email forwards to me just fine, however I'm experiencing two issues I'm hoping someone could help me out with:
I'd like to keep this pipe as lean as possible.
But at the moment I'm just trying to set up the forwarder properly.
PHP:
#!/usr/bin/php -q
<?php
$fd = fopen( "php://stdin", "r" );
$message = "";
while ( !feof( $fd ) )
{
$message .= fread( $fd, 1024 );
}
fclose( $fd );
mail('[email protected]','New message!',$message)
?>
- The $message appears in plain text with all of the MIME stuff - so the email just looks like jibberish to the average user.
- Although the email gets forwarded just fine, the sender gets an email saying that it has bounced (even though the script has worked perfectly)
I'd like to keep this pipe as lean as possible.