Bob Eastbrook:
> Forgive me if this is a FAQ, but I've looked all over and I don't see
> it addressed.
> 
> I have a wildcard MX record for *.example.com which points to
> mail.example.com.  I know how to configure postfix to accept
> individual virtual domains such as host1.example.com, but how can I
> set it up to handle any domains which match the wildcard MX record?
> e.g.:
> 
> b...@host1.example.com
> b...@host2.example.com
> b...@gibberish.example.com
> 
> ... should all map to b...@mail.example.com.  I'm only concerned about
> the user "bob" if that matters.  I won't know in advance all the hosts
> in example.com, so I can't add them one at a time.

APPEND a regular expression map to your virtual_alias_maps
definition.

/etc/postfix/main.cf:
    virtual_alias_maps =
        ...stuff you perhaps already have...
        pcre:/etc/postfix/virtual_alias.pcre

/etc/postfix/virtual_alias.pcre:
    # Send b...@whatever.example.com to b...@example.com.
    /^bob@([^.]+\.)+example\.com$/      b...@example.com

Further reading:
man 5 virtual (http://www.postfix.org/virtual.5.html)
man 5 pcre_table (http://www.postfix.org/pcre_table.5.html)
man pcrepattern (http://www.pcre.org/pcre.txt, look for section "PCREPATTERN")

        Wietse

Reply via email to