如何批量删除邮件,根据主题关键字?
linux吧
全部回复
仅看楼主
level 2
如何根据主题关键字删除邮件?目前邮箱里有15万封信,按数字删除,怕删掉其他重要邮件。
2016年04月15日 06点04分 1
level 11
15万封[汗]
2016年04月15日 06点04分 2
大部分都是博客程序发的邮件,由于对方主机不接受,导致的退信。以前没学到mail程序,所以不知道已经积累了两年[泪]
2016年04月15日 06点04分
level 2
提供一个参考
I did something similar myself recently using procmail, one of the best mail filtering programs out there by looping through all e-mails and executing procmail on them and removing an e-mail afterwards like this:
Code:
#!/usr/bin/env sh
set -e
for dir in cur new; do
find $INPUTMAILDIR/$dir -type f | while read file; do
procmail < $file
rm $file
done
done
You need to add a correct rule to your ~/.procmailrc before running this script. The rule could look like this:
Code:
:0:
* ^Subject:.*Mail delivery failed: returning message to sender*
/dev/null
BTW, I also recommend procmail as an every-day filtering program for your e-mail. You can make it execute an arbitrary action based on e-mail sender, subject, body or attachments.
2016年04月15日 07点04分 3
1