Thomas Landauer via Postfix-users:
> Hi,
> 
> please add `to=` to logfile lines like this:
> 
> > 4YqPkV4jYnz44Pv: from=<f...@example.com>, status=expired, returned to sender

The above is logged by te queue manager.

Almost immediately in the before this, there will be one or more
lines that were logged by a delivery agent program:

    4YqPkV4jYnz44Pv: to=<whatever>, ..., status=deferred (random text)

You can get that information in two ways:

1) By sending a copy of the bounce message to the local postmaster.
   Postfix bounce messages are formatted as described in RFC 3462.
   See https://www.postfix.org/postconf.5.html#notify_classes

2) By processing the log. Viktor wrote a script called collate, it
   is mentioned here frequently, and it is bundled with Postfix
   source code. All records for the same queue ID are grouped into
   blocks of text separated by an empty line. 

   You can post-process those blocks separated by empty line with

    awk 'BEGIN { RS = "" } 
        /, status=expired, / { ...do stuff with to=... }
    '

The information is not available in the queue manager. One message
can have multiple recipents, and by design the queue manager does
not try to keep all recipients in memory.

> Less important:
> You could also add the usual `dsn=` field with the information that's 
> given in the DSN mail which Postfix sends:
> 
> > Status: 4.4.1

The per-recipient status is never ever available in the queue
manager, not even for a subset.

        Wietse
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to