Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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. 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

mydestination = $mydomain, mail.$mydomain
local_recipient_maps = ldap:/etc/postfix/
local_transport = lmtp:unix:/var/lib/imap/socket/lmtp

/etc/postfix/ is LDAP configuration file to search for mail addresses.

What do I need to configure on postfix?

share|improve this question

migrated from Sep 6 '11 at 23:19

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

In you create a new "ruby" configuration for the ruby script to accept mails. This is done via pipe as described in You can probably already see some examples (with pipe in the last column) in your current 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 content    ruby:    ruby:

This will pass mails for these persons to the ruby transport you configured in as long as you named it "ruby". Then run postmap /etc/postfix/transport_maps.

After that you need a new line in with

transport_maps = hash:/etc/postfix/transport_maps

Reload the Postfix daemon. From then the configured addresses go through ruby and the others go through the transport configured with local_transport.

share|improve this answer
I did as suggested, but mails to above example is being rejected with error 550 Recipient address rejected: User unknown in local recipient table ##. I guess that I need to add above address to some other maps, but I don't know to which map and to what it should point to? – Marko Sep 7 '11 at 9:47
This is absolutely unrelated to this question. This has to be fixed before asking this question. The address must be in your LDAP (and the domain, too). – mailq Sep 7 '11 at 10:48
If I add address to LDAP, it will automatically deliver to user account (since cyrus will create non existant account on delivery attempt). How does postfix decides to deliver to particular transport? If seems to me that postfix is ignoring transport_maps in my setup (postconf does show it is configured). – Marko Sep 7 '11 at 11:12
Postfix decides on the transport map as described in – mailq Sep 7 '11 at 11:14
You were right. After I cleaned a lot of other configuration that were causing problems, it worked! – Marko Sep 7 '11 at 17:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.