linux/unix 下 删除sendmail -bp 邮件队列

linux下,使用sendmail -bp 或者 mailq 可以查看到邮件发送队列,里边会列出有几个邮件等待发送。

[]#mailq
                /var/spool/mqueue (2 requests)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
pBN6jQ42026230   125278 Fri Dec 23 14:45 <gateway@localhost.localdomain>
      8BITMIME   (Deferred: 452 Too many recipients received this hour)
                                         <digdeeply@staff.sina.com.cn>
pBN6kF7B026383   125278 Fri Dec 23 14:46 <gateway@localhost.localdomain>
      8BITMIME   (Deferred: 452 Too many recipients received this hour)
                                         <digdeeply@staff.sina.com.cn>
                Total requests: 2

邮件队列的文件都保存在 /var/spool/mqueue/ 文件夹内,查看此文件夹时,可以看到邮件队列内的邮件:

[]#ls /var/spool/mqueue/
dfpBN6jQ42026230  dfpBN6kF7B026383  qfpBN6jQ42026230  qfpBN6kF7B026383

如果需要删除队列,直接清空该文件夹即可:

[]#rm /var/spool/mqueue/*

查看邮件发送日志:

[]#tail -f /var/log/maillog
Dec 23 14:49:22 localhost sendmail[26851]: starting daemon (8.13.8): SMTP+queueing@01:00:00
Dec 23 14:49:22 localhost sm-msp-queue[26861]: starting daemon (8.13.8): queueing@01:00:00