[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Postfix configuration (mail to root)



Magnus Therning <magnus@therning.org> wrote:

> On Fri, Sep 29, 2006 at 20:07:18 +0300, Andrei Popescu wrote:
> >Magnus Therning <magnus@therning.org> wrote:
> >
> >> >This is how I've configured it:
> >> >
> >> > % cat /etc/mailname
> >> > my.remote.host
> >
> >> > % hostname -f
> >> > my.local.host
> >
> >Maybe I'm wrong, but it seems to me that /etc/mailname should also be
> >'my.local.host'
> 
> But then I can't send emails because a lot of servers out there do a
> lookup on the server name in the envelope header and my.local.host is on
> a private LAN and can't be looked up.
> 
> Basically, the setup I want is:
> 
>  root and other local accounts are delivered locally
>  non-local accounts are forwarded to the relayhost
> 
> To have the latter work I need to make sure that the envelope header
> contains an address with a domain that can be looked up on the internet.
> That's what I get by sticking my.remote.host in /etc/mailname.  However,
> that seems to screw up local delivery :-(
> 
> I can't see that this is a very unique situation, AFAICS that is exactly
> what Internet With Smart Host is when I run 'dpkg-reconfigure postfix'.

You can do this with rewriting. I just set this up today so its fresh :)

/etc/postfix/main.cf:

	smtp_generic_maps = hash:/etc/postfix/generic

then create /etc/postfix/generic with something like this:

	user@my.local.host	account@my.remote.host

and run 'postmap /etc/postfix/generic

Now if the mail is for root@my.local.host it will be delivered
according to your aliases file. Mail for user@some.internet.host will
be sent to respective address with rewriten From:

Regards,
Andrei
-- 
If you can't explain it simply, you don't understand it well enough.
(Albert Einstein)



Reply to: