-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Wietse Venema
Sent: Saturday, March 05, 2011 6:26 PM
To: Postfix users
Subject: Re: Running a script, archiving, then forwarding.

Alan Fullmer:
> I am attempting to receive mail from one or many domains.  I am then 
> trying to run a script that [essentially] archives all mail coming
through.
> Lastly, forwarding the messages onto another server.

Use the Postfix built-in recipient_bcc_maps feature to ADD a recipient that
resolves to your script.

/etc/postfix/main.cf:
   recipient_bcc_maps = pcre:/etc/postfix/recipient_bcc
   transport_maps = hash:/etc/postfix/transport
   script_destination_recipient_limit = 1

/etc/postfix/recipient_bcc:
   /(.*)@(the\.example\.com)$/  $1-$2@some-domain-here

/etc/postfix/transport:
    some-domain-here    script:

/etc/postfix/master.cf:
    script unix  -       n       n       -       -       pipe
        flags=FR user=some-user-here argv=/some/where/script $recipient

References:
http://www.postfix.org/postconf.5.html#recipient_bcc_maps
http://www.postfix.org/postconf.5.html#transport_maps
http://www.postfix.org/postconf.5.html#transport_destination_recipient_limit
http://www.postfix.org/transport.5.html
http://www.postfix.org/master.5.html


        Wietse


-------------

So this works wonderfully.  It does everything as expected, except the
forwarding after the script has run.  I added the IP of the server in
relayhost:
relayhost = [192.168.10.1]

But it acts like it's not even paying attention to that.

This is the only thing that doesn't seem to be working properly.

Any thoughts?

Thanks.

Reply via email to