Oh boy, this is my last resort.
I have a mail filter set up through CPanel:
$header_to: is "[email protected]"+++++++| /home/myaccount/mailmgr/process.php
So I want any email sent to [email protected] to be processed by process.php which reads as below (right now it's just a dummy script which writes the email out to a file, just so I can see if it's working - there's no error trapping or anything else going on.)
#!/usr/bin/php -q
<?php
$outfilename = "mailout";
$email = "";
$infile = fopen("php://stdin", "r");
while (!feof($infile)) {
$email .= fread($infile, 1024);
}
fclose($infile);
$fout=fopen("./$outfilename","w");
fwrite($fout, $email);
fclose($fout);
php?>
The thing is, it works (almost) perfectly. The email comes in, gets filtered, piped to the script which reads it and dumps it to a file. However, the person sending the email gets the following message by return.
"This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
pipe to | /home/myaccount/mailmgr/process.php
generated by [email protected]
The following text was generated during the delivery attempt:
------ pipe to | /home/myaccount/mailmgr/process.php
generated by [email protected] ------"
So basically, it's working, but the person sending still gets an error back. Anyone have any ideas? Is it my PHP? Is it CPanel? Is it something else?
I've torn most of my hair out already. Any help would be appreciated before I lose what little I have left. PS. Apologies for the slightly messy PHP.
EDIT: For the record, after my own attempt (described above) failed, I followed the how-to at http://forums.cpanel.net/showthread.php?t=50985&highlight=mail+filter+php in case I missed something. It results in EXACTLY the same error.
I've also checked both attempts using CPanel's "Filter Test" tool, and it seems to think everything is fine. Is there anything else anyone can think of?
I have a mail filter set up through CPanel:
$header_to: is "[email protected]"+++++++| /home/myaccount/mailmgr/process.php
So I want any email sent to [email protected] to be processed by process.php which reads as below (right now it's just a dummy script which writes the email out to a file, just so I can see if it's working - there's no error trapping or anything else going on.)
#!/usr/bin/php -q
<?php
$outfilename = "mailout";
$email = "";
$infile = fopen("php://stdin", "r");
while (!feof($infile)) {
$email .= fread($infile, 1024);
}
fclose($infile);
$fout=fopen("./$outfilename","w");
fwrite($fout, $email);
fclose($fout);
php?>
The thing is, it works (almost) perfectly. The email comes in, gets filtered, piped to the script which reads it and dumps it to a file. However, the person sending the email gets the following message by return.
"This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
pipe to | /home/myaccount/mailmgr/process.php
generated by [email protected]
The following text was generated during the delivery attempt:
------ pipe to | /home/myaccount/mailmgr/process.php
generated by [email protected] ------"
So basically, it's working, but the person sending still gets an error back. Anyone have any ideas? Is it my PHP? Is it CPanel? Is it something else?
I've torn most of my hair out already. Any help would be appreciated before I lose what little I have left. PS. Apologies for the slightly messy PHP.
EDIT: For the record, after my own attempt (described above) failed, I followed the how-to at http://forums.cpanel.net/showthread.php?t=50985&highlight=mail+filter+php in case I missed something. It results in EXACTLY the same error.
I've also checked both attempts using CPanel's "Filter Test" tool, and it seems to think everything is fine. Is there anything else anyone can think of?
Last edited: