OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Looking for clever forwarding scheme, oh Postfix/UNIX gurus!

From: Dean Gibson (Mail Administrator) (postfix3ultimeth.com)
Date: Sun Oct 03 2004 - 22:35:13 CDT


I receive all eMail at mail server mail.domain.com. I want eMail that I
receive at a specific eMail address (say xxxdomain.com) to always be
forwarded to yyyzzz.domain.com, where I have a specific process running
that will automatically process the eMail (via procmail). The problem is,
the DNS definition of zzz.domain.com varies, depending on which machine I
have the automated process running.

Usually zzz.domain.com is a different machine from mail.domain.com, but
sometimes zzz.domain.com is the same machine as mail.domain.com, depending
upon the DNS definition of zzz (this is done to allow easy switching to a
backup SQL server process).

I can get both cases to work by changing the virtual alias map file on
mail.domain.com, but I would like a solution where I just change the DNS
definition of zzz and the eMail automatically goes to the correct place,
without having to change the Postfix configuration. The problem is:

1. When zzz.domain.com and mail.domain.com are the same machine, Postfix
apparently needs a line in the virtual alias map on mail.domain.com that
handles yyyzzz.domain.com, in order for Postfix to deliver the eMail on
that machine.

2. When zzz.domain.com and mail.domain.com are different machines, Postfix
cannot have yyyzzz.domain.com listed in the virtual alias map on machine
mail.domain.com, or Postfix will not forward the eMail to the other machine.

Creative suggestions welcome!

One solution is to use procmail or the aliases database to forward eMail to
user "xxx" via an external command (using "|"): The external command could
be a script that would generate the correct target eMail address, depending
on the current DNS definition of zzz.domain.com. I would like a cleaner
solution if possible, that just uses Postfix configuration options/files.

I'm running Postfix 2.0.11.

-- Dean