Email Piping to php file

panosru

Verified User
Joined
Oct 8, 2006
Messages
80
Location
Greece
Hello, I'm using DA v1.33.7 and I would like to create an email pipe that will forward the emails of an address to a php file.

For example if I have the email [email protected] I go to DA email forwarders and I set the following values:

Forwarder Name: [email protected]
Destination Email: "|/home/admin/domains/example.com/public_html/billing/pipe.php"

The file is chmoded to 755 and it begins with #!/usr/bin/php -q so it looks like this:

Code:
#!/usr/bin/php -q
<?php
//code bellow

by running whereis php on my server I got this:

Code:
server:~# whereis php
php: /usr/local/bin/php /usr/local/lib/php /usr/local/lib/php.ini

So maybe I should use #!/usr/local/bin/php -q instead of #!/usr/bin/php -q?

Also if I try to send an email on the email it bounces it:

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/admin/domains/example.com/public_html/billing/pipe.php
   generated by [email protected]
   local delivery failed

*I replaced my email with [email protected]

Under /home/admin/domains/example.com/ there isn't any aliases file and Exim Mainlog contains this:

Code:
2009-09-08 16:51:55 1Ml16x-0005lw-5T ** |/home/admin/domains/example.com/public_html/billing/pipe.php ([email protected]) <[email protected]> F=<[email protected]> R=virtual_aliases_nostar T=virtual_address_pipe: Child process of virtual_address_pipe transport returned 127 (could mean unable to exec or command does not exist) from command: /home/admin/domains/example.com/public_html/billing/pipe.php

EDIT:
I changed #!/usr/bin/php -q to #!/usr/local/bin/php -q and it worked! :)
 
Last edited:
thanks man!

Same problem. and I fix with #!/usr/local/bin/php -q in the top of .php file


bye!
 
Back
Top