Fwd email to php script


#1

A 3rd party script I want to install requires that I set up an email address which forwards to a local PHP script.

One of the examples given in the script documentation is:
|php /home/yourlogin/scriptpath/script.php

There is also a “.procmailrc” example.

I contacted tech support, but they said that “this sort of issue is beyond the scope of tech support to solve for you”.

Can anyone help with this?


#2

Just a bump in hopes of a reply!


#3

Have you tried either of these, and are you having a problem with one of them?

Sounds like that’s about how to do it. The easiest solution is probably to create a new user, and put the “|php /home/you/yourfile.php” line in a file called “.forward.postfix” in that user’s home directory. All email directed at that user will then be forwarded to the PHP script.

If you don’t want to create a new user, the procmail example would be better, as it would give you more control over what email goes to the PHP script. (eg. only email with a particular subject or destination address.)

Note that the control panel uses procmail to do its email filters, so you can’t use the email filter control panel for a user whose email is being forwarded to procmail.


#4

Mark,

I treid adding the line into .forward.postfix but the email bounces back with the error:

Command died with status 1:
"/usr/local/bin/php /home/[user]/keitai/wp-keitaimail.php"

Putting “|php /home/[user]/keitai/wp-keitaimail.php” returns a command not found, that’s why I went with “|/usr/local/bin/php /home/[user]/keitai/wp-keitaimail.php”

blueorder


#5

ah, right… I remember now, someone mentioned PHP isn’t installed on the mail servers.

Here’s a thread over in the “programming” forum where people were talking about this same issue. (although that page says php is installed on the mail servers…)


#6

Mark,

Thanks for the reply…unfortunately, I’ve tried that method also…I’m the last post on that thread…

blueorder