How to use Procmail with PHP?

I am trying to use procmail to send email to a PHP script, so the script will check the MySQL database and edit the subject line based on the email of the sender. I believe that I have a working procmail for this:

:0:
* ^To:.*@barrett.com
! '/usr/local/bin/php-5.2 -f $HOME/ticket/emailcustcheck.php'

However, I'm not sure exactly how procmail executes this command. How email is transferred to a PHP script, and therefore, how can I link to it inside a script?

0
source share
2 answers

The correct syntax for connecting to a script is

:0   # no lock file
* ^To:.*@barrett\.com
| /usr/local/bin/php-5.2 -f $HOME/ticket/emailcustcheck.php  # no quotes, use pipe

The action !will try to redirect to an email address, but, of course, a long line with the path to your PHP interpreter is not a valid email address.

(.. PHP script ), ; Procmail , , , . , - , concurrency (, script , ) , .

regex , , Cc mail, direct To:. ^TO_ , .

script ; , , , "", "body". , , PHP , .

0
:0 wf
* ^To:.*@barrett\.com
| /usr/local/bin/php-5.2 -f $HOME/ticket/emailcustcheck.php

f procmail, , . w , , .

, b , h

0

All Articles