查看队列
postqueue -p
删除队列邮件根据ID
postsuper -d MessageID
如果当前的系统队列很长,负担很重,我们可以把队列里的邮件先hold
postsuper -h ALL
当处理完后,再把队列移回来
postsuper -r ALL
根据发送者来删除队列邮件,替换 "info@otherdomain.com"就可以
#$7=sender, $8=recipient1, $9=recipient2 --字段解释
mailq |awk 'BEGIN{RS=""}{if($7=="info@otherdomain.com"&&$9=="")print $1}'| tr -d '*!'| postsuper -d -
根据收件人删除,替换you@yourdomain.com 就可以
mailq |awk 'BEGIN{RS=""}{if($8=="you@yourdomain.com"&&$9=="")print $1}'| tr -d '*!'| postsuper -d -
根据发生服务器的hostname来删除,替换掉 senderhostname
mailq |grep senderhostname| awk '{print $1}'| tr -d '*!'| postsuper -d -
参考文章