emails stuck in maildrop


I had misconfigured postfix + amavisd-new combo for a few minutes. At
that time I have recieved a few messages which looped between postfix
and amavisd-new, and are now in maildrop queue.

I have the following messages in maillog:

Sep 11 18:21:07 mx2 postfix/pickup[85251]: C071F61E4F18: uid=125 from=< ... at example dot org> orig_id=286AC61E5027
Sep 11 18:21:07 mx2 postfix/cleanup[89279]: warning: C071F61E4F18: message rejected: hopcount exceeded
Sep 11 18:21:07 mx2 postfix/cleanup[89279]: C071F61E4F18: message-id=< ... at mx2 dot>
Sep 11 18:21:07 mx2 postfix/pickup[85251]: warning: maildrop/286AC61E5027: error writing C071F61E4F18: queue file write error

Any chance to resend these messages? Or delete them with NDR? Any other
advice with this?

Thank you in advance,


Re: emails stuck in maildrop

By Viktor Dukhovni at 09/11/2018 - 12:41

You'd have to trim the message header to drop some of the "Received" headers.

One way to do that is to add header checks to match just the headers added
during the loop, and to raise the maximum hopcount temporarily so that
cleanup will accept the messages, but drop the excess headers to prevent
triggering similar limits downstream.

First test the header checks with:

# postcat -h -q <queue-id> |
postmap -h -q - pcre:/path/to/header_checks

Just the unwanted headers should trigger an "IGNORE" action.

This needs to run as "root" or "postfix" to read the queue files. If you
don't have or use PCRE, use "regexp".