I need to pass a copy of messages for a given address to an external script so that they can be processed by another system. I'd rather not use fetchmail, and eat one of my customer's licenses.

What's the easiest way to create an alias to an external script? If I create this alias in /etc/aliases:

userid: |/usr/local/bin/filter.pl

...a message sent to "userid@example.com" creates log entries that look like this:

Feb 19 23:23:10 november postfix/smtpd[16866]: 12C1A12DB01FF: client=qmta02.emeryville.ca.mail.comcast.net[]
Feb 19 23:23:10 november postfix/cleanup[16871]: 12C1A12DB01FF: message-id=<47BBD55C.3010600@eburg.com>
Feb 19 23:23:10 november postfix/qmgr[16724]: 12C1A12DB01FF: from=<sender@sender.com>, size=1363, nrcpt=1 (queue active)
Feb 19 23:23:15 november postfix/smtpd[16877]: 8289A12DB0202: client=localhost.localdomain[]
Feb 19 23:23:15 november postfix/cleanup[16871]: 8289A12DB0202: message-id=<47BBD55C.3010600@eburg.com>
Feb 19 23:23:15 november postfix/qmgr[16724]: 8289A12DB0202: from=<sender@sendercom>, size=2007, nrcpt=1 (queue active)
Feb 19 23:23:15 november postfix/smtp[16872]: 12C1A12DB01FF: to=<userid@example.com>, orig_to=<userid@hostname.example.com>, relay=[]:10024, delay=5.7, delays=0.09/0/0/5.6, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 8289A12DB0202)
Feb 19 23:23:15 november postfix/qmgr[16724]: 12C1A12DB01FF: removed
Feb 19 23:23:15 november postfix/error[16878]: 8289A12DB0202: to=<userid@example.com>, relay=none, delay=0.32, delays=0.24/0.01/0/0.08, dsn=5.0.0, status=bounced (example.com)
Feb 19 23:23:15 november postfix/bounce[16879]: 8289A12DB0202: sender non-delivery notification: D155012DB0206
Feb 19 23:23:15 november postfix/qmgr[16724]: 8289A12DB0202: removed

So, it fails and I get a bounce. None of it's terribly useful in pinpointing the problem. I enabled verbose messages at one point, and it didn't look like postfix was looking at /etc/aliases, though main.cf lists it in "alias_maps", per the default configuration. I assume this is because the domain only uses "virtual_alias_maps"?

What do I need to do?