On 10/5/2016 9:33 PM, Peter wrote: > On 04/10/16 23:12, Anton Bruckner wrote: >> Hello, >> i have following scenario: >> >> Many external mail domains resolve to one single ip address ex 1.2.3.4 after >> dns lookup - is it now possible, to define a rule that says - >> relay any mail with destination host "1.2.3.4" to relay host "5.6.7.8" ? >> >> I know that i can do it with a transport rule - but only with names, not ip >> addresses. >> >> Any ideas ? > > You can do it by recipient MX hostname, which should be close enough: > > smtpd_recipient_restrictions = ... check_recipient_mx_access > hash:/etc/postfix/mx_transports > > > /etc/postfix/mx_transports: > > mail.example.com FILTER :[myrelay.example.net] > ... > > > Peter >
Unfortunately FILTER is per-message, not per-recipient, so this will likely misroute multirecipient mail. So far there isn't a good fix in postfix for this particular problem. You could use FILTER to an intermediate postfix hop with recipient limit of 1 to split up any multi recipient mail, but that's kind of messy. Right now mangling the destination with your firewall or DNS is the best solution. -- Noel Jones --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
