Reputation: 3
I want to use procmail to forward all incoming email to an email address. Normally I would just do this:
:0
! [email protected]
BUT: In this case I don't know the receiver. Insteasd, the receiver is calculated by a PHP script based on the incoming email content.
So I need something like this:
:0c
| /usr/bin/php /var/www/calculatereceiver.php <== The output of this script is the $RECEIVER address
:0
! $RECEIVER
Of course the above code doesn't work. My problem is: How can I manage that procmail forwards the mail to the output of thwe first script?
Best greetings,
Sven
Upvotes: 0
Views: 707
Reputation: 10903
Try the following:
RECEIVER=`/usr/bin/php /var/www/calculatereceiver.php`
:0
! $RECEIVER
More secure version that may not work with all sendmail look alikes:
RECEIVER=`/usr/bin/php /var/www/calculatereceiver.php`
:0
! -- $RECEIVER
man procmailrc
:
Any program in backquotes started by procmail will have the entire mail at its stdin
Upvotes: 1