使用邮件服务首先保证服务器能ping通公网
*查看队列
*查看队列
postqueue -p
*删除队列邮件根据ID
postsuper -d MessageID
mailq | tail +2 | awk ‘BEGIN { RS = “” }# $7=sender, $8=recipient1, $9=recipient2{ if ($7 == “info@otherdomain.com” && $9 == “”)print $1 }‘ | tr -d ‘*!’ | postsuper -d -
*根据收件人删除
,替换you@yourdomain.com 就可以
mailq | tail +2 | awk ‘BEGIN { RS = “” }# $7=sender, $8=recipient1, $9=recipient2{ if ($8 == “you@yourdomain.com” && $9 == “”)print $1 }‘ | tr -d ‘*!’ | postsuper -d -
*根据发生服务器的hostname来删除
,替换掉 senderhostname
mailq | grep senderhostname | awk ‘{ print $1} ‘| postsuper -d -
*如果当前的系统队列很长,负担很重,我们可以把队列里的邮件先hold
postsuper -h ALL
*当处理完后,再把队列移回来
postsuper -r ALL
postfix本身可以作为命令使用:
*启动postfix
postfix start
*停止postfix
postfix stop
*重新读取postfix配置文件
postfix reload
*立即投递队列中所有邮件(慎用)
postfix flush
*修复队列以及任何权限错误
postfix check
常用操作:
postqueue -p 列出队列里的所有邮件
postsuper -d ID 删除一封邮件
postsuper -d ALL 删除所有邮件
postsuper –h ID 保留邮件
postsuper -r ALL 重新排例
postcat -q ID 显示邮件内容
postqueue -f 清空邮件