From: Josef G. Bauer on
Hi,

I have posted this on news:alt.comp.mail.postfix without getting a
reply.

I really would like to know, if I should use the proposes solution.


I need to deliver mail to hosts in my domain
(ANY_HOST.intranet.mydomain.com) directly via smtp, elsewhere via a
relayhost.

Now I got:

------------------------------------------------------------ main.cf -
relayhost = mail.myprovider.com
transport_maps = regexp:/etc/postfix/transport
----------------------------------------------------------------------

---------------------------------------------------------- transport -
/^.*@pelikan$/ :
/^.*@pelikan\.intranet\.mydomain\.com$/ :
/^.*@[^.]*$/ smtp:
/^.*@[^.]*\.intranet\.mydomain\.com$/ smtp:
----------------------------------------------------------------------

'pelikan' is the hostname of the local machine.

This solution seems to work, just looks very complicated to me.


Is there an easier solution?


Greetings

Josef

From: Wietse Venema on
Josef G. Bauer:
> Hi,
>
> I have posted this on news:alt.comp.mail.postfix without getting a
> reply.
>
> I really would like to know, if I should use the proposes solution.
>
> I need to deliver mail to hosts in my domain
> (ANY_HOST.intranet.mydomain.com) directly via smtp, elsewhere via a
> relayhost.

Using the built-in precedence order of relayhost and transport_maps:

/etc/postfix/main.cf:
# Deliver ANY_HOST.intranet.mydomain.com directly.
transport_maps = hash:/etc/postfix/transport

# Deliver other destinations via the provider.
relayhost = mail.myprovider.com

/etc/postfix/transport:
.intranet.mydomain.com :

Some things may be easier to express with a procedural language.
For that, you could use

transport_maps = tcp:host:port

or some other programmed solution.

Wietse

From: Josef G. Bauer on
Hi Wietse,

thanks for your answer.


> /etc/postfix/transport:
> .intranet.mydomain.com :

But if an email was addresses to baj(a)pelikan (without the domain)
wouldn't it be delivered via the relayhost then?

Greetings

Josef

From: Wietse Venema on
Josef G. Bauer:
> Hi Wietse,
>
> thanks for your answer.
>
>
> > /etc/postfix/transport:
> > .intranet.mydomain.com :
>
> But if an email was addresses to baj(a)pelikan (without the domain)
> wouldn't it be delivered via the relayhost then?

Postfix does not support that. (You can configure it to use
domain-less addresses but it is not recommended.)

Wietse

> Greetings
>
> Josef
>
>

From: Victor Duchovni on
On Wed, May 26, 2010 at 02:46:39PM +0200, Josef G. Bauer wrote:

> Hi Wietse,
>
> thanks for your answer.
>
>
> > /etc/postfix/transport:
> > .intranet.mydomain.com :
>
> But if an email was addresses to baj(a)pelikan (without the domain)
> wouldn't it be delivered via the relayhost then?

In default configurations Postfix rewrites this to
"baj(a)pelikan.$mydomain", *before* resolving to a transport.

http://www.postfix.org/ADDRESS_REWRITING_README.html#standard
http://www.posfix.org/postconf.5.html#append_dot_mydomain

--
Viktor.