SpamAssassin Simple Application _unix Linux

Source: Internet
Author: User
Tags spamassassin qmail
Here we only talk about the simple application of SpamAssassin, using SpamAssassin's rule set to label spam as spam, and then using policy to automatically transfer messages with spam characters to the junk e-mail directory in client Outlook.

Refer to the article
Ccert chinese spam Filtering rule set
(http://www.ccert.edu.cn/spam/sa/Chinese_rules.htm)

Test environment: redhat9.0
Prerequisite: Already installed qmail, this article has built the environment is Qmail+vpopmail+igeus

1: Install SpamAssassin
Installation Method 1: Directly through the CPAN installation
PERL-MCPAN-E Shell
Install Mail::spamassassin

2: Compile and install yourself
Go to http://spamassassin.apache.org to download the latest version of the software

After decompression: # Perl makefile.pl
# make
# make Install

# for a spam and non-spam test
In SpamAssassin source files directory:
Spamassassin-t < Sample-spam.txt > Spamtest.txt
Less spamtest.txt
Spamassassin-t < Sample-nonspam.txt > Nospamtest.txt
Less nospamtest.txt
The Spamtest.txt file will contain the "*****spam*****" line in the topic section, but not in the Nospamtest.txt file.
(Default read/ETC/MAIL/SPAMASSASSIN/LOCAL.CF configuration.)

If you have an error during make, refer to this article to resolve the problem http://blog.5ilinux.com/archives/2005/07/spamassassin.html

3: Configure LOCAL.CF files
# VI/ETC/MAIL/SPAMASSASSIN/LOCAL.CF

# How many hits before a-is considered spam.
Required_hits 9.5

# Text to prepend to subject if Rewrite_subject is used
Rewrite_header Subject * * * spam * * * *

# Encapsulate spam in a attachment
Report_safe 1

# Enable The Bayes system
Use_bayes 1

# Enable Bayes auto-learning
Bayes_auto_learn 1

# Enable or disable network checks
Skip_rbl_checks 1
Use_razor2 0
USE_DCC 0
Use_pyzor 0

# Mail using languages used in country codes won't be marked
# as being possibly spam in a foreign language.
Ok_languages All

# Mail using locales used in country codes won't be marked
# as being possibly spam in a foreign language.
Ok_locales All

For spamassassin configuration files, refer to the SpamAssassin 3.x configuration Guide (Chinese version)
(http://anti-spam.org.cn/references/index.php?Action=Show&ID=9)

4: Download the Chinese rule set for junk mail
Wget-n-p/usr/share/spamassassin WWW.CCERT.EDU.CN/SPAM/SA/CHINESE_RULES.CF

The combination of 5:qmail and SpamAssassin

Compiling QMAIL-SPAMC in the SPAMC directory of SpamAssassin 3.x
# Cc-o-O QMAIL-SPAMC qmail-spamc.c
# install-m 755 Qmail-spamc/var/qmail/bin

# ln-s/var/qmail/bin/qmail-queue/usr/bin/qmail-queue

Edit/etc/tcp.smtp as follows
127.:allow,relayclient= ""
: allow,qmailqueue= "/VAR/QMAIL/BIN/QMAIL-SPAMC"

And then:
Tcprules tcp.smtp.cdb Tcp.smtp.tmp < TCP.SMTP

In the compiled directory SPAMD directory
MV REDHAT-RC-SCRIPT.SH/ETC/RC.D/INIT.D/SPAMD

Start SPAMD
/ETC/RC.D/INIT.D/SPAMD start

This spamassassin will automatically judge the spam according to the rule set, and put the spam messages that are considered potentially possible into the junk mail * * * * * * * * * * * * * * * * * *, at a glance, as for client Outlook how to set policy to automatically transfer spam, I don't need to say.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.