Stefan Bertels:
> On Tue, 11 Oct 2011, Wietse Venema wrote:
> > Stefan Bertels:
> >> I tried adding domain part to the right side, too:
> >>
> >> /etc/postfix/virtual
> >>    p...@stefan-bertels.de stefan@localhost
> >
> > To deliver some address locally, you need to (surprise) specify a
> > destination domain name that delivers locally.
> 
> This is some suprise to me because I had a simple solution with some 
> virtual_alias file on my previous machine running exim. There was a 
> simple config rule replacing the whole address without any need for 
> adding a whole domain. Seems I now need some more complicated config 
> here.

Not at all. It takes only a few lines as shown below.

> > 1) A destination domain name that is listed in mydestination or in
> > virtual_mailbox_domains.
> >
> > 2) A destination domain name that is not subject to some wild-card
> > address rewrite or some routing override (transport_maps, content_filter,
> > etc.). If such an override exists, specify an explicit identity mapping
> > for the destination domain name to exclude it from the override.
> 
> I don't fully understand part "2)". Seems I'm not that familar with 
> technical details of postfix to make this work without studying the 
> postfix system in high detail. Seems I can get it to deliver 
> *@stefan-bertels.de locally and to replace the local part of all 
> addresses (e.g. post => stefan). But I have no idea how to get mails to 
> all other addresses to my smarthost. Could you spotlight this by giving 
> an example or some hint?

It does not get much simpler than this.

To deliver (almost) all mail to the smarthost:

    /etc/postfix/main.cf:
        myorigin = example.com
        mydestination = localhost localhost.example.com
        relayhost = mail.example.net

To deliver SOME addresses locally:

    /etc/postfix/main.cf:
        virtual_alias_maps = hash:/etc/postfix/virtual

    /etc/postfix/virtual:
        r...@example.com        root@localhost
        tar...@example.com      tarzan@localhost

http://www.postfix.org/BASIC_CONFIGURATION_README.html
http://www.postfix.org/STANDARD_CONFIGURATION_README.html
http://www.postfix.org/ADDRESS_CLASS_README.html

        Wietse

Reply via email to