Documentation http://spamassassin.apache.org/
1. Install spamassassin on the server
# yum install spamassassin
2. Install required perl CPAN modules
# perl -MCPAN -e shell
cpan> install Digest::SHA1
cpan> install HTML::Parser
cpan> Install option perl modules…
2. Edit spamassassin configuration in /etc/mail/spamassassin/local.cf .
# Encapsulate spam in an attachment (0=no, 1=yes, 2=safe)
report_safe 0
# Enable the Bayes system
use_bayes 1
# Enable Bayes auto-learning
bayes_auto_learn 1
# Enable or disable network checks
skip_rbl_checks 0
use_razor2 1
use_dcc 1
use_pyzor 1
# Mail using languages used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_languages all
# Mail using locales used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_locales all
3. Tell procmail to run spamc on everyone’s mail. Add these to /etc/procmailrc :
DROPPRIVS=yes
:0fw
| /usr/bin/spamc
4. Restart spamassassin
# service restart spamassassin
Did you like this? Share it:
In scripting programming languages such as perl, php and python use string quotation extensively. To include single or double quote inside the string quotation, you’ll have escape the character with a backslash. Perl string quotation operators (q, qq and qx) let you avoid putting too many backslashes into quoted strings.
q/STRING/, or q(STRING) – Single Quotes, does not allow interpolation.
qq/STRING/, or qq(STRING) – Double Quotes, allow interpolation.
qr/EXPR/, or qr(EXPR) – Regexp-like quote
qx/STRING/, or qx(STRING) – Backquote, executes external command inside backquotes.
The difference between the single quote and double quote is interpolation. Double quote allows string to be replaced with the value of that variable inside the quote, while single quote doesn’t allow it.
The q operator (single quote) example:
#!/usr/bin/perl -w
$name = “Cindy”;
$str = q/This is $name’s dog./;
print $str;
The above script prints the following output.
This is $name’s dog.
The qq operator (double quote) example:
#!/usr/bin/perl -w
$name = “Cindy”;
$str = qq(This is $name’s dog.);
print $str;
The above script prints the following output.
This is Cindy’s dog.
The qr operator (regex quote) example:
#!/usr/bin/perl -w
$regex = qr/[io]n/i;
print $regex, “\n”;
$string = “I am on chair in the room.”;
$string =~ s/$regex/XX/mg;
print $string, “\n”;
The above script prints the following output.
I am XX chair XX the room.
Regular Expression Options:
m Treat string as multiple lines.
s Treat string as single line. (Make . match a newline)
i Do case-insensitive pattern matching.
x Use extended regular expressions.
p When matching preserve a copy of the matched string so
that ${^PREMATCH}, ${^MATCH}, ${^POSTMATCH} will be defined.
o Compile pattern only once.
The qx operator (backquote) example:
#!/usr/bin/perl -w
$str = qx(date);
print $str;
The above script prints the following output.
Wed May 18 19:30:36 CDT 2011
If the delimiter is an opening bracket or parenthesis, the final delimiter will be the corresponding closing bracket or parenthesis.
Did you like this? Share it: