从 sendmail mqueue 中删除特定电子邮件

从 sendmail mqueue 中删除特定电子邮件

如何mqueue根据目标地址删除电子邮件。需要删除发送至“的延迟消息”[电子邮件受保护]

由于无限循环(已被发现并纠正),我有大量电子邮件被推迟或排队等待重试var/spool/mqueue。需要尽快清除这些,因为反弹消息每 20 分钟就会填满我的 var/log 文件夹空间 1G。

队列中也有合法的电子邮件,因此不能只是空的var/spool/mqueue。如何筛选出我要查找的结果?而且,我需要先停止 sendmail 吗?

由于。。。导致的结果df-h显示文件系统 100% 使用mqueue/dev/sda2因为var/log

root@tsunami12:/var/log# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             32G     0   32G   0% /dev
tmpfs           6.3G  650M  5.7G  11% /run
/dev/sda2        28G   28G    0G 100% /
tmpfs            32G     0   32G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            32G     0   32G   0% /sys/fs/cgroup
/dev/sda4       2.1T  986G 1013G  50% /home
tmpfs           6.3G     0  6.3G   0% /run/user/1000
tmpfs           6.3G     0  6.3G   0% /run/user/1002
tmpfs           6.3G     0  6.3G   0% /run/user/1003

ls -lh 的结果mqueue

root@tsunami12:/var/spool/mqueue# 
ls -lh

-rw-r----- 1 smmta smmsp    0 Mar 17  2020 df02H2TsFs012156
-rw-r----- 1 root  smmsp 2.8K Apr 14 10:17 df33EDseEV018975
-rw-r----- 1 root  smmsp 3.6K Apr 14 10:12 df33EECwjo001842
-rw-r----- 1 root  smmsp 2.3K Apr 14 10:43 df33EEhHEt023903
-rw-r----- 1 root  smmsp 2.3K Apr 14 10:45 df33EEj5ai025020

由于。。。导致的结果邮件q命令

33J38Htu005703     3623 Tue Apr 18 23:08 <[email protected]>
                  (Deferred)
                                          <[email protected]>
                                          <[email protected]>
                                          <[email protected]>
                                          <[email protected]>
                                          <[email protected]>
33J382mj005213     3623 Tue Apr 18 23:08 <[email protected]>
                 (Deferred)
                                         <[email protected]>
                                         <[email protected]>
                                         <[email protected]>
                                         <[email protected]>
                                         <[email protected]>

来自 root@tsunami12 的结果:/var/log#尾邮件.log命令

Apr 19 15:54:56 tsunami12 sm-mta[22495]: 33INJGL5000565: to=<[email protected]>,<[email protected]>,<[email protected]>,<[email protected]>, delay=20:35:40, xdelay=00:00:00, mailer=esmtp, pri=10924132, relay=smtpin01.vzw.a.cloudfilter.net., dsn=4.0.0, stat=Deferred: Connection reset by smtpin01.vzw.a.cloudfilter.net.
Apr 19 15:54:56 tsunami12 sm-mta[15318]: 33J0R2EH028306: to=<[email protected]>,<[email protected]>, delay=19:27:53, xdelay=00:00:00, mailer=esmtp, pri=10655014, relay=att-e2xms-west.mx.a.cloudfilter.net., dsn=4.0.0, stat=Deferred: Connection reset by att-e2xms-west.mx.a.cloudfilter.net.
Apr 19 15:54:56 tsunami12 sm-mta[15318]: 33J0R2EH028306: to=<[email protected]>, delay=19:27:53, xdelay=00:00:00, mailer=esmtp, pri=10655014, relay=tmo-east.mx.a.cloudfilter.net., dsn=4.0.0, stat=Deferred: Connection reset by tmo-east.mx.a.cloudfilter.net.
Apr 19 15:54:56 tsunami12 sm-mta[15318]: 33J0R2EH028306: to=<[email protected]>,<[email protected]>,<[email protected]>,<[email protected]>, delay=19:27:53, xdelay=00:00:00, mailer=esmtp, pri=10655014, relay=smtpin01.vzw.a.cloudfilter.net., dsn=4.0.0, stat=Deferred: Connection reset by smtpin01.vzw.a.cloudfilter.net.

答案1

从记忆中我记得有df*文件和相应的qf*文件,但由于我不在sendmail这里运行,所以我不能保证这一点。您应该发现一种可接受的方法是从/var/spool/mqueue包含该文本的文件中删除[email protected]。不完美但非常接近。

cd /var/spool/mqueue
mkdir /var/spool/mq.rm
mv $(grep -l '[email protected]' *) ../mq.rm

现在,您的邮件队列应该大大缩短,并且目录中的邮件待删除/var/spool/mq.rm

一如既往,在应用于您的生活环境之前进行彻底测试

相关内容