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