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 support@example.com I go to DA email forwarders and I set the following values:

Forwarder Name: support@example.com
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 support@example.com
   local delivery failed
*I replaced my email with support@example.com

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 (support@example.com) <support@example.com> F=<foo@bar.com> 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:

mauro33

Verified User
Joined
Apr 3, 2015
Messages
13
thanks man!

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


bye!
 
Top