I'm trying to get Postfix to pipe ALL email coming in on a specific domain to a PHP script. So far I've been able to do this via a tutorial I found on the web and also editing the /etc/postfix/virtual
file with something like what's below;
@domain.com root
The problem is that Postfix is re-writing the original recipient email address (for example [email protected]) to [email protected] and the PHP script receiving the email does not get the original recipient ([email protected]). It is important that the PHP script sees [email protected] instead of [email protected].
Is it possible for Postfix to direct all incoming mail to the PHP script without modifying the address like in the example above?
Note: There can/will potentially be 10,000's of incoming email addresses.
Any ideas on how I can get Postfix to do what I want?
You could set an additional header via Postfix:
create a
/etc/postfix/appendheader.regexp
:in
/etc/postfix/main.cf
:This will add an
X-Original-To:
-header with the original mail address before it's getting rewritten. Have your PHP-Script parse this header instead of theTo:
-Header.