开源邮件服务器 开源邮件服务器 web 开源邮件 开源 mail 开源 邮件服务器 邮件技术 mail技术 反垃圾邮件 反垃圾mail mail投递
邮件服务器 mail服务器 开源软件 mail软件 mail服务新品牌 开源邮件服务新品牌
开源mail服务新网站 邮件服务新品牌 mail tmail mailserver 163邮件 sendmail |Linux维护|Linux代维|成都Linux维护|成都Linux代维
论坛
搜索
帮助
导航
注册
登录
开源邮件技术社区
»
垃圾邮件过滤
» My dspam Training Script
返回列表
回复
发帖
scyzxp
发短消息
加为好友
scyzxp
当前离线
791
802
0
17
200
2005-12-9
管理员
1
#
打印
字体大小:
t
T
发表于 2009-3-30 15:21
|
只看该作者
My dspam Training Script
Training
,
Script
,
dspam
#!/bin/sh
# train-spam.sh
#
# Description: Checks each user's /home/Maildir/.Spam.Missed
# directories to see if the user placed any "missed" spam
# messages which got through SpamAssassin to their INBOX.
# If there are messages in this directory, then the script
# invokes sa-learn to update the site-wide tokens to try
# and improve the defenses for next time...
#
# learn_spam - Function which takes a directory and a user as
# arguments, and then feeds that directory to our anti-spam
# applications for further SPAM training.
#
# Arguments:
# $1 - Directory name containing SPAM emails. Required
# $2 - User name. If it is not provided, $USER will be used.
#
# Example:
# learn_spam /home/alank/Maildir/.Spam.Missed/cur alank
#
function learn_spam {
# loop through all emails in given directory
for email in $(ls $1); do
# process SPAM email using DSPAM
/usr/local/bin/dspam --mode=teft --source=error --class=spam --feature=chained,noise --user $2 < $1/$email
echo -n "."
# delete SPAM email
rm $1/$email
done # end of email loop
} # end function learn_spam
# learn_ham - Function which takes a directory and a user as
# arguments, and then feeds that directory to our anti-spam
# applications for further HAM training.
#
# Arguments:
# $1 - Directory name containing HAM emails. Required
# $2 - User name. If it is not provided, $USER will be used.
#
# Example:
# learn_ham /home/alank/Maildir/.Spam.NotSpam/cur alank
#
function learn_ham {
# loop through all emails in given directory
for email in $(ls $1); do
# process HAM email using DSPAM
/usr/local/bin/dspam --mode=teft --source=error --class=innocent --feature=chained,noise --user $2 < $1/$email
echo -n "."
# delete HAM
rm $1/$email
done # end of email loop
} # end function learn_ham
#
# Script starts here!
#
# loop through all user home directories
for file in $(ls /home); do
# if there is a Spam/Missed maildir
if [ -d /home/$file/Maildir/.Spam.Missed/cur ]; then
# then process any missed SPAM
echo -n "missed spam for $file: "
learn_spam /home/$file/Maildir/.Spam.Missed/cur $file
learn_spam /home/$file/Maildir/.Spam.Missed/new $file
echo ""
fi # end if
# if there is a Spam/NotSpam dir
if [ -d /home/$file/Maildir/.Spam.NotSpam/cur ]; then
# then process any falsely identified spam, i.e. HAM
echo -n "false positives for $file: "
learn_ham /home/$file/Maildir/.Spam.NotSpam/cur $file
learn_ham /home/$file/Maildir/.Spam.NotSpam/new $file
echo ""
fi # end if
done # end for loop
echo "Done!"
复制代码
附件:
您需要
登录
才可以下载或查看附件。没有帐号?
注册
收藏
分享
成都成都Linux维护,代维。FreeBSD维护,代维,维护各种服务器。
回复
引用
返回列表
开源资讯
其它服务器维护
Tmail程序发布
论坛意见箱
PHP代码
Postfix
web服务器维护
自由贴图
[收藏此主题]
[关注此主题的新回复]
[通过 QQ、MSN 分享给朋友]