first – you want to get the postfix-delete.pl script from here:
http://www.cyberciti.biz/tips/howto-postfix-flush-mail-queue.html
Next – create a script to inspect the mailq and then a single message – finally, ask if the message should be deleted – very linear script..
#!/bin/sh
cd /var/spool/postfix/deferred/;
MAILQCHECK=`mailq`;
if [ "$MAILQCHECK" = "Mail queue is empty" ]
then
echo $MAILQCHECK;
exit 0;
fi
##
## if we get here, the mailq is not empty...
##
echo $MAILQCHECK | more;
echo 'Enter mail ID to inspect:';
read MAILID;
if [ "$MAILID" != "" ]
then
strings */$MAILID | more;
echo 'Delete?'
read SHALLIDELETE;
SHALLIDELETE=`echo $SHALLIDELETE| tr '[a-z]' '[A-Z]'`; export SHALLIDELETE;
if [ "$SHALLIDELETE" = "Y" ]
then
##
## get the postfix-delete.pl from http://www.cyberciti.biz/tips/howto-postfix-flush-mail-queue.html
##
/root/postfix-delete.pl $MAILID ;
exit 0;
else
echo 'exiting without delete...';
exit 0;
fi
else
##
## they didn't enter an ID - exit
##
echo 'exiting...';
exit 0;
fi