Postfix VDA Autoresponder Configuration
These notes describe older software and hardware. Commands, dependencies, and external links may no longer work or be appropriate for current systems.
This historical guide explains how to configure a Postfix autoresponder when mail is delivered by the Virtual Delivery Agent (VDA). It routes a copy of each message through a Postfix pipe transport while the original continues to virtual delivery.
How the Postfix VDA autoresponder works
The Postfix Virtual Delivery Agent ( VDA, aka virtual(8) ) is a local delivery agent written to abstract the email user from the system user. virtual(8) is a ment to handle the task of getting messages from the queue manager (qmgr) into a local mailbox. What makes virtual(8) different than local(8) is that the location of the mailbox is determined witha map lookup. The UID/GID owning the mailbox is also configured with a map. This allows the postmaster to place the mailboxes anywhere on disk they like. When combined with a modern POP3/IMAP server this can be a fantastic way to manage mailboxes.
The design of virtual(8) limits its usefulness in some cases. While local(8) can execute commands from an aliases or .forward file, virtual(8) will not do either. Since virtual(8) is run as a configurable (on a per mailbox basis) UID, it does not even attmept to enter security sensative realms such as program execution. But almost every "vacation" program out there is run from a .forward file, which implies real system users. The solution is to use other parts of postfix to get around the (good) limitations of virtual(8).
This is where the names of some of the postfix processes gets in the way. Postfix has two components named "virtual". There is virtual(5) and there is virtual(8). The VDA is virtual(8), where the (8) simply refers to the section of the manpages where this process's documentation is. The other "virtual", virtual(5) is really a map format used by the cleanup(8) daemon to rewrite the recipient address of emails as they come in. The naming is confusing but the purpose of each is clearly seperate. In the quest of a working autoresponder virtual(5) is going to help us split each incoming email into two. One will be allowed to pass to the VDA and another will be sent to a different, specially formatted address.
"What specially formatted address?" you say. Well, this is the tricky bit. We need to get the email message to an autoresponder program. That autoresponder will be explained in a moment. The most secure way to do this is through Postfix's pipe(8) transport. We can have pipe(8) run our autoresponder program and we can get message to pipe using a transport map. I told you this was tricky. Here is a little diagram of how this will work.

Message 1 comes in via STMP and gets split during cleanup into messages 2 and 3. Both are given to the queue manager which sends the message with the original recipient address off to virtual(8) for placement in the user's maildir. Message 3 is routed via a transport map to the pipe transport set to run our autoreply command. The autoreply command looks at the message and forms a new message if it decides it should reply to the message. This final message, number 4, leave postfix via SMTP (some steps are ommitted for the path of message 4, but you get the idea).
Most versions of postfix can route mail in a transport map based on the recipient's domain name (very new snapshots can do this on a per-address basis). Assuming the server is handling the email for example.com (please don't try to use this, I'm sure the postmaster@example.com has better things to do), we will create a subdomain called autoreply.example.com. Now this subdomain does not have to exist in DNS, in fact it may be better that it doesn't. It only exists in our transport map and our virtual(5) rewrite table. Your transport map (normally located at /etc/postfix/transport) should look like this:
example.com virtual: autoreply.example.com autoreply:
Make sure to run postmap /etc/postfix/transport after editing this file. At this point if you email something @autoreply.example.com it will fail since we haven't defained what the autoreply transport is. Carefully add the following lines to /etc/postfix/master.cf :
autoreply unix - n n - - pipe
flags=F user=nobody
argv=/usr/bin/perl /usr/local/bin/autoreply.pl $sender $recipient
autoreply.pl is a perl script that uses Net::LDAP to pull the autoresponder message out of a directory server.