====== 整理處理 sendmail / postfix 的工具 ======
===== 刪除與搬移 mqueue 信件 =====
==== postfix ====
* 主要是使用 postsuper 這指令
- 刪除所有在 Queue 中的郵件
postsuper -d ALL
- 刪除還再重試發送的郵件
postsuper -d ALL deferred
* 參考網址 : https://blog.miniasp.com/post/2008/03/24/How-to-delete-undelivered-email-in-Postfix.aspx
==== sendmail ====
* 下載 qtool.pl 工具
su - root
wget http://www.cyberciti.biz/files/perl/qtool.pl.txt
mv qtool.pl.txt qtool.pl
chmod a+x qtool.pl
* 查看 mail queue
mailq
[root@kvm-mail ~]# mailq
/var/spool/mqueue (7 requests)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
s5KFWHYA005580 713 Fri Jun 20 23:32 <>
(Deferred: Connection timed out with dialup-62-11-236-182.cli)
(Deferred: Connection timed out with mailx.tcommerce.de.)
kraemer-lemmer@tonline.de
s5I7HYV7002743 1 Wed Jun 18 15:20
(readqf: cannot open ./dfs5I7HYV7002743: No such file or dire)
Total requests: 7
* 查看 s5I7HYV3002743 信件內容
cat /var/spool/mqueue/dfs5I7HYV3002743
* 確認要刪除 s5I7HYV3002743
./qtool.pl -d /var/spool/mqueue/s5I7HYV3002743
* 再透過 mailq 可以看到這筆已經消失
* 參考網址 : http://www.cyberciti.biz/faq/linux-unix-bsd-clear-sendmail-queue/
{{tag>sendmail postfix mail 郵件}}