I have uploaded a patch to the primary Postfix source code mirror
that adds support to the Postfix SMTP client to rewrite non-delivery
status codes and text.

ftp://ftp.porcupine.org/mirrors/postfix-release/experimental/feature-patches/20140315-smtp-bounce-defer-filter-patch
ftp://ftp.porcupine.org/mirrors/postfix-release/experimental/feature-patches/20140315-smtp-bounce-defer-filter-patch.sig

The description is under the signature.

        Wietse

This is a minimal patch to add support for NDR filtering in the
Postfix SMTP client.  It should work with Postfix 2.11, 2.12,
and it may even work with Postfix 2.10.

smtp_bounce_defer_filter (default: empty)

       Optional filter to rewrite the three-number enhanced  status  code  and
       the  explanatory  text  in a Postfix SMTP/LMTP client bounce/defer mes-
       sage.

       With each bounce or defer request, the user-specified filter is queried
       with one line of text that is structured as follows:

           enhanced-status-code SPACE explanatory-text

       The  bounce_defer_filter  feature  may replace this only with text that
       has the same structure.  Enhanced status codes must have a first numer-
       ical  field of 4 (defer) or 5 (bounce), and the free text field must be
       non-empty. Other results will result in a warning.

       Example:

       The following example turns soft TLS errors into hard errors, by  over-
       riding the first number in the enhanced status code.

           /etc/postfix/main.cf:
               smtp_bounce_defer_filter = pcre:/etc/postfix/smtp_ndr_filter

           /etc/postfix/smtp_ndr_filter:
               /^4(\.\d+\.\d+ TLS is required, but host \S+ refused to start 
TLS: .+)
                   5$1
               /^4(\.\d+\.\d+ TLS is required, but was not offered by host .+)
                   5$1
               # Do not change the following into hard bounces. They may
               # result from a local configuration problem.
               # 4.\d+.\d+ TLS is required, but our TLS engine is unavailable
               # 4.\d+.\d+ TLS is required, but unavailable
               # 4.\d+.\d+ Cannot start TLS: handshake failure

       Notes:

       o      This  feature  modifies error messages that are generated by the
              Postfix SMTP client, and that may or may  not  be  derived  from
              remote  SMTP server responses.  In contrast, the smtp_reply_fil-
              ter feature modifies  remote  SMTP  server  responses  that  may
              result in email non-delivery or delivery.

       o      This feature will NOT override the soft_bounce safety net.

       o      This  feature  will  apply to all bounce/defer messages from the
              Postfix SMTP/LMTP client.

       o      This feature will change the enhanced status code and text  that
              is  logged  to  the  maillog  file, and that is reported tot the
              sender.

Reply via email to