Postfix queue(邮件队列) 管理

From time to time the mail queue may get filled up. This may be due to network problems or misconfiguration. For instance, if you botch (typo) the relayhost parameter, the mail will be undeliverable. The first thing to do is fix the problem, meaning get the network back online, or fix the configuration.

1. try and deliver the mail from the queue(强制发送队列中的邮件):

$ postfix flush or $ postqueue -f 

2. check mail queue size (查看队列大小):

$ mailq | wc -l 

3. list mails in queue (查看队列中的邮件):

$ postqueue -p or $ mailq

4.put all deferred mail “on hold” so that no attempt is made to deliver it(暂缓发送队列中的问题邮件):

$ postsuper -h ALL deferred

5. release mail that was put “on hold”(解除暂缓发送):

$ postsuper -H ALL deferred

6. purge all deferred emails from the queue without delivering (删除队列中问题的邮件):

$ postsuper -d ALL deferred $ find /var/spool/postfix/deferred -type f -exec rm -vf {} \;

7. purge specific email from the queue by specifying its message ID (按邮件ID删除队列中的邮件):

$ postsuper -d 0C0FF240F2

8. 删除已经三天未发出的邮件

$ find /var/spool/postfix/deferred -type f -mtime +3 -exec rm -f {} \;

9. 列出所有问题邮件

$ find /var/spool/postfix/deferred -type f \ -exec ls -l --time-style=+%Y-%m-%d_%H:%M:%S {} \;

10. 删除超过5天的问题邮件的退信记录

$ find /var/spool/postfix/defer -type f -mtime +5 -exec rm -f {} \;

11. 复杂用法:利用grep得到特定的邮件ID,再删除,如:

$ mailq | grep -B 1 "Hotconcerts@gmail.com" | cut -f 1 -d ! > deletionIDs" $ cat deletionIDs | postsuper -d - 
From:http://www.tigerdad.cn/postfix-queue-mail-queue-management.html
Postfix 中,邮件从发送者发出后,经过多个队列和处理过程,最终被成功投递到接收者的邮箱中。下面是邮件从发送者到接收者的大致流程: 1. 发送者将邮件发送到 Postfix 的入站队列(incoming queue)。 2. Postfix邮件进行基本的预处理和合法性检查,例如检查邮件头是否合法、是否来自已知的发件人等等,如果检查失败,则该邮件会被退回给发送者。 3. 如果邮件检查通过,则会被放入到激活队列(active queue)中,等待后续的处理。 4. 在激活队列中,Postfix 会检查邮件的目的地,然后将其放入到相应的传输队列(transport queue)中,该队列负责管理和传输该邮件的所有信息,包括接收者的域名、MX 记录、IP 地址等等。 5. 在传输队列中,Postfix 会根据 DNS 查询结果,建立与目的邮件服务器的 SMTP 连接,并将该邮件发送到目的地。 6. 如果邮件传输成功,则该邮件会被放入到传输完成队列(transferred queue)中,等待本地交付或者再次传输。 7. 如果邮件传输失败,则该邮件会被退回到激活队列,重新等待处理。 8. 在传输完成队列中,Postfix 会将邮件进行本地交付,或者将其再次放入到传输队列中进行重新传输。 综上所述,邮件从发送者到接收者的过程中,Postfix 会涉及到入站队列、激活队列、传输队列和传输完成队列。这些队列共同协作,确保邮件能够被成功投递到接收者的邮箱中。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值