MailScanner相关规则设置

1、垃圾邮件白名单

编辑Mailscanner配置文件
# vi /etc/Mailscanner/Mailscanner.conf
Is Definitely Not Spam = /etc/MailScanner/rules/whitelist.rules
规则文件格式如下:
# vi /etc/MailScanner/rules/whitelist.rules
##添加被列入白名单的地址:
From:    user@domain.com    yes
From:    *@domain.com    yes
##添加被列入白名单的IP的地址
From:    192.168.1.    yes
From:    /^192\.168\.13[4567]\./    yes
FromOrTo:    default    no

 

2、垃圾邮件黑名单

编辑Mailscanner配置文件
# vi /etc/Mailscanner/Mailscanner.conf
Is Definitely Spam = /etc/MailScanner/rules/blacklist.rules
规则文件格式如下:
# vi /etc/MailScanner/rules/blacklist.rules
##添加被列入白名单的地址:
From:    user@domain.com    yes
From:    *@domain.com    yes
##添加被列入黑名单的IP的地址
From:    192.16.8.1.    yes
FromOrTo:    default    no

 

3、对发送的邮件进行签名

编辑Mailscanner配置文件
# vi /etc/Mailscanner/Mailscanner.conf
Sign Clean Messages = /etc/MailScanner/rules/signing.rules
规则文件格式如下:
# vi /etc/MailScanner/rules/signing.rules
##添加发送的域名
From:    *@domain.com    yes
##添加IP地址
From:    192.168.1.    yes
FromOrTo:    default    no

 

4、对不同的域使用不同的签名

编辑Mailscanner配置文件
# vi /etc/Mailscanner/Mailscanner.conf
Inline Text Signature = /etc/MailScanner/rules/sig.text.rules
Inline HTML Signature = /etc/MailScanner/rules/sig.html.rules
规则文件格式如下:
# vi /etc/MailScanner/rules/sig.text.rules
##添加不同的域
From:    *@domain1.com    /etc/MailScanner/reports/domain1.sig.txt
From:    *@domain2.com    /etc/MailScanner/reports/domain2.sig.txt
设置不同的域使用的HTML签名
# vi /etc/MailScanner/rules/sig.html.rules
##添加不同的域
From:    *@domain1.com    /etc/MailScanner/reports/domain1.sig.html
From:    *@domain2.com    /etc/MailScanner/reports/domain2.sig.html

 

5、只对某些域进行病毒扫描

编辑Mailscanner配置文件
# vi /etc/Mailscanner/Mailscanner.conf
Virus Scanning = /etc/MailScanner/rules/virus.scanning.rules
规则文件格式如下:
# vi /etc/MailScanner/rules/virus.scanning.rules
FromOrTo:    *@domain.com    yes
FromOrTo:    default    no

 

6、给多个人发送管理员通知

编辑Mailscanner配置文件
# vi /etc/Mailscanner/Mailscanner.conf
Notices To = /etc/MailScanner/rules/notices.to.rules
规则文件格式如下:
# vi /etc/MailScanner/rules/notices.to.rules
##增加地址
To: @domain1.com postmaster@domain.com admin@domain1.com
To: @domain2.com postmaster@domain.com admin@domain2.com
FromOrTo:    default    postmaster@domain.com

 

7、只隔离某些病毒

编辑Mailscanner配置文件
# vi /etc/Mailscanner/Mailscanner.conf
Quarantine Infections = /etc/MailScanner/rules/quarantine.rules
规则文件格式如下:
# vi /etc/MailScanner/rules/quarantine.rules
##增加病毒名称
Virus: sobig    no
Virus: default    yes

 

8、在规则中使用两个条件

编辑Mailscanner配置文件
# vi /etc/Mailscanner/Mailscanner.conf
Spam Actions = /etc/MailScanner/rules/spam.actions.rules
规则文件格式如下:
# vi /etc/MailScanner/rules/spam.actions.rules
##增加条件
From:    domain.com and To: user@*    deliver
FromOrTo:    domain1.com and FromOrTo:    domain2.com    deliver
FromOrTo:    default    store notify

 

9、使用perl匹配更高级的规则:

规则文件格式如下:
##匹配 user@domain.com以及user@sub.domain.com
From:    /[\@\.]domain\.com$/    yes
##匹配所有 .gov
From:    /\.gov$/    yes
##匹配德国或丹麦的域
From:    host:/(de|dk)$/    yes

 

10、设置邮件大小

规则文件格式如下:
# vi /etc/MailScanner/rules/max.message.size.rules
To:    *@domain1.com    10M
To:    *@domain2.com    20M
From:    user@domain3.com    5M
From:    *@domain3.com    500K
FromOrTo:    default    0

标签