I have mail server setup to use postfix and cyrus imapd + ldap for mail lookups.
Now I would like to specify that for particular address (e.g. [email protected]) instead of delivering mail to mailbox it gets passed to script (ruby script to be more precise). I need this functionality since I would like to have mails passed to particular address to end up on our redmine server. How to do this?
Currently I have in main.cf:
...
mydestination = $mydomain, mail.$mydomain
local_recipient_maps = ldap:/etc/postfix/ldapvirtual.cf
local_transport = lmtp:unix:/var/lib/imap/socket/lmtp
...
/etc/postfix/ldapvirtual.cf is LDAP configuration file to search for mail addresses.
What do I need to configure on postfix?
In
master.cf
you create a new "ruby" configuration for the ruby script to accept mails. This is done viapipe
as described in http://www.postfix.org/pipe.8.html You can probably already see some examples (withpipe
in the last column) in your currentmaster.cf
. But how to configure it depends on the ruby script and the related system environment.Then you need a file (for example)
/etc/postfix/transport_maps
with the contentThis will pass mails for these persons to the ruby transport you configured in
master.cf
as long as you named it "ruby". Then runpostmap /etc/postfix/transport_maps
.After that you need a new line in
main.cf
withReload the Postfix daemon. From then the configured addresses go through ruby and the others go through the transport configured with
local_transport
.