postfix-users November 2011 archive
Main Archive Page > Month Archives  > postfix-users archives
postfix-users: Re: How to relay email to a different smtp server

Re: How to relay email to a different smtp server if received on a different (reinjection) port

From: <lst_hoe02_at_nospam>
Date: Sat Nov 05 2011 - 08:57:11 GMT
To: postfix-users@postfix.org

Zitat von "martijn.list" <martijn.list@gmail.com>:

> Hi,
>
> I have a after queue content filter. The content filter injects the
> email back into Postfix after filtering the email, aka reinjection port.
> After reinjecting the email, I would like Postfix to relay the email to
> a different host than the default relay host, i.e., if email is received
> by Postfix on the reinjection port, relay the email to server 192.168.6.6.
>
> One solution seems to define a content_filter for the reinjection
> handler in master.cf:
>
> external unix - - n - 4 smtp
>
> 127.0.0.1:10026 inet n - n - 10 smtpd
> -o content_filter=external:192.168.6.6:25
> -o smtpd_recipient_restrictions=permit_mynetworks,reject
> -o mynetworks=127.0.0.0/8
>
> The content filter reinjects the email back into Postfix on
> 127.0.0.1:10026. Postfix then again filters the email and uses the
> external processor which sends the email to 192.168.6.6:25.
>
> Is this the best way to do this or are there better/more elegant ways to
> do this?

Hello Martijn

as far as i know this is the best solution if "routing by incoming
service" is required and no multi-instance setup is desired. The other
solutions are more address (access tables with action FILTER) and
content centric (header/body checks).

Regards

Andreas