mailfiter 过滤ip

 

#--------ip filter------------
if(/^Received: from (.*) by (.*)/)
{
   FROMIP=$MATCH1
   if($FROMIP ne "")
   {
       if (lookup($FROMIP, ".blockip"))
       {
          echo "[block ip]::$FROMIP::F:$SENDER,T:$EXT@$HOST,drop letter"
          to /dev/null
          exit
       }

   }
}

 

qmail .mailfilter 过滤中文标题垃圾邮件

 

if(/^Subject:.*/)
{
    SUBJECT=$MATCH  #提取出base64编码的邮件标题
    #echo "[subject]::$SUBJECT"
} 
if ($SUBJECT ne "")
{ 
   #将标题转换为中文 
   #maildecod 请访问http://hello386.is-programmer.com/posts/25736.html
   
   NSUB=`/usr/local/sbin/maildecod $SUBJECT` 
   #echo "[NSUB]::$NSUB"
}
if (lookup($NSUB, ".badsubject"))
{
       echo "[bad_subject]::$SUBJECT::F:$SENDER,T:$EXT@$HOST,drop letter"
       to /dev/null
       exit
}