About three years ago I had a pretty similar question: <20130924132623.ga23...@citecs.de> .
The answer I got: On Tue, Sep 24, 2013 at 09:37:11AM -0400, Wietse Venema wrote: > > If by chance someone could provide a pointer to the documentation > > of the queue file format this would be appreciated as well. > > The file format is private. Modification by non-Postfix programs > breaks the warranty, meaning no support. > > Wietse I believe this should do the trick: #!/bin/bash IP_TO_DELETE="10.2.3.4" mailq | awk '/^[A-F0-9]/ { mid=$1; qfile=$1 ; sub(/^(.)/,"/var/spool/postfix/deferred/&/&",qfile); print mid, qfile };' | while read mid qfile ; do # echo "#### $mid : $qfile ####" CLIENT_IP=$( postcat -e "$qfile" | awk -F= '$1 == "named_attribute: client_address" { print $2 }' ) if [ "$CLIENT_IP" = "$IP_TO_DELETE" ]; then postsuper -d "$mid" fi done