I'd like to pipe mail addressed to support@domain to a PHP script.
For the moment, the script does nothing other than send an email to me so that I can tell that it is being executed.
This seems to be working more or less correctly after a bit of confusion and changing the PHP script's permissions.
However something is not quite right as the sender receives a delivery failure message when sending to support@domain.
Here's what happens:
1. Sender sends email to support@domain.
2. Mail addressed to support@domain is piped, using Cpanel email filters, to a PHP script.
3. I receive an email sent by the script, therefore indicating that the script is executing.
4. Sender receives a delivery failure message:
A mailbox exists for support@domain and without the email filter in place emails sent to support@domain are being delivered correctly. Delivery failure messages are only generated when the email filter is in place to pipe mail to a PHP script and the PHP script is being executed.
From reading previous delivery failure messages when things weren't working, I can see that the delivery failure message includes the output from the script (PHP errors). There is now nothing being output by the script.
The full script to which mail is piped is:
I have no idea why mail sent to support@domain is generating delivery failure messages when the mail is being piped to the script correctly and the script is executing without any errors.
Any ideas what might be causing the delivery failures?
For the moment, the script does nothing other than send an email to me so that I can tell that it is being executed.
This seems to be working more or less correctly after a bit of confusion and changing the PHP script's permissions.
However something is not quite right as the sender receives a delivery failure message when sending to support@domain.
Here's what happens:
1. Sender sends email to support@domain.
2. Mail addressed to support@domain is piped, using Cpanel email filters, to a PHP script.
3. I receive an email sent by the script, therefore indicating that the script is executing.
4. Sender receives a delivery failure message:
Code:
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/cos/mailhandlers/test.php
generated by support@domain
From reading previous delivery failure messages when things weren't working, I can see that the delivery failure message includes the output from the script (PHP errors). There is now nothing being output by the script.
The full script to which mail is piped is:
Code:
#!/usr/local/bin/php
<?php
mail("me@domain", "test message from mail handler", "msg");
?>
Any ideas what might be causing the delivery failures?