Wietse Venema:
> Tobi:
> > I wonder if the following idea is somehow "do-able" in postfix. We have
> > a fallback postfix instance which gets all mails that our scanners could
> > not send to our customers target server. Now the fallback tries to
> > submit those msg to our customers. Sometimes our customers do not know
> > how to manage dns and delete an important record (like the a-rec for the
> > target server). We do not manage their zones, that's done by themselves.
> > 
> > Now we thought that it would be very nice if we could "tell" our
> > fallback instance that in case of NXDomain in DNS lookup of a target
> > server to return a DEFER (4xx) instead of a REJECT (5xx).
> > I found soft_bounce parameter in the docs but that seems too wide, as we
> > would only soft bounce in case of NXDomain results of target servers and
> > not for any other reason. Is it possible to use smtp_dns_reply_filter to
> > filter for NXDomain results and return a DEFER action?

Of course Postfix can, it just isn't called smtp_dns_reply_filter

Instead, use smtp_delivery_status_filter.

The filter is invoked with a string of the form :

    enhanced-status-code SPACE explanatory-text

For example:

    5.4.4 Host or domain name not found. Name service error for...

So the following could do the trick for your fallback relay host:

/etc/postfix/main.cf:
     smtp_delivery_status_filter = pcre:/etc/postfix/fallback_status_filter

/etc/postfix/fallback_status_filter:
    /^(5\S+\s+Host or domain name not found.+)/ 4$1

This changes the hard error into a soft one, and is more selective
than setting soft_bounce=yes.

        Wietse

Reply via email to