문제

I want to use procmail to forward all incoming email to an email address. Normally I would just do this:

:0
! email@domain.com

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

도움이 되었습니까?

해결책

Procmail: program/script output to variable (email on STDIN)

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

Documentation references

man procmailrc :

Any program in backquotes started by procmail will have the entire mail at its stdin

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top