spamassassin - mail filter to identify spam using text analysis
spamassassin [options] < mailmessage > output
spamassassin -d < mailmessage > <output>
spamassassin -r [-w addr] < mailmessage
spamassassin -W|-R < mailmessage
Options:
-P, --pipe Deliver to STDOUT (now default) -L, --local Local tests only (no online tests) -r, --report Report message as spam -w addr, --warning-from=addr Send a warning mail to sender from addr -d, --remove-markup Remove spam reports from a message -C file, --config-file=file Set configuration file -p prefs, --prefs-file=file Set user preferences file -x, --nouser-config Disable user config files -e, --exit-code Exit with a non-zero exit code if the tested message was spam -l filename, --log-to-mbox=file Log messages to a mbox file -t, --test-mode Pipe message through and add extra report to the bottom --lint Lint the rule set: report syntax errors -a, --auto-whitelist Use auto-whitelists -W, --add-to-whitelist Add addresses in mail to whitelist --add-to-blacklist Add addresses in mail to blacklist -R, --remove-from-whitelist Remove all addresses found in mail from whitelist --add-addr-to-whitelist=addr Add addr to whitelist --add-addr-to-blacklist=addr Add addr to blacklist --remove-addr-from-whitelist=addr Remove addr from whitelist -M, --whitelist-factory Select whitelist factory -D, --debug [area=n,...] Print debugging messages -V, --version Print version -h, --help Print usage message
If you run tests with the -a option, the scores will be added to the AWL. This may not be what you want to do. If it is not, then don't use -a -t.
If the message contains SpamAssassin markup, this will be stripped out automatically before submission. The support modules for DCC and Razor must be installed for spam to be reported to each service.
spamassassin
or spamd
with the -a switch for this to work.
spamassassin
or spamd
with the -a switch.
Note that you must be running spamassassin
or spamd
with the -a switch.
spamassassin
or spamd
with the -a switch.
spamassassin
or spamd
with the -a switch.
spamassassin
or spamd
with the -a switch.
(Note: the message will not be exactly identical; some headers will be reformatted due to some features of the Mail::Internet package, but the body text will be.)
spamassassin -D rulesrun=255
SpamAssassin is a mail filter to identify spam using text analysis and several internet-based realtime blacklists.
Using its rule base, it uses a wide range of heuristic tests on mail headers and body text to identify ``spam'', also known as unsolicited commercial email.
Once identified, the mail is then tagged as spam for later filtering using the user's own mail user-agent application.
SpamAssassin also includes support for reporting spam messages to collaborative filtering databases, such as Vipul's Razor ( http://razor.sourceforge.net/ ).
The default tagging operations that take place are detailed in TAGGING.
The rule base, text templates, and rule description text are loaded from the configuration files.
By default, configuration data is loaded from the first existing directory in: /usr/local/share/spamassassin;/usr/share/spamassassin;./rules;../rules
The configuration data in the first existing directory in: /usr/local/etc/spamassassin;/usr/pkg/etc/spamassassin;/usr/etc/spamassassin;/etc/mail/spamassassin;/etc/spamassassin are used to override any values which had already been set
Spamassassin will read *.cf in these directories, in alphanumeric order within each directory (similar to SysV-style startup scripts). In other words, it will read 10_misc.cf before 50_scores.cf and 20_body_tests.cf before 20_head_test.cf. Options in later files will override earlier files.
The user preferences (such as scores to attach to each rule), are loaded from
the file specified in the -p argument. If this is not specified,
~/.spamassassin/user_prefs is used if it exists. spamassassin
will create this
file if it does not exist, using user_prefs.template as a template. This file will be looked for in
/etc/spamassassin/user_prefs.template;/usr/local/share/spamassassin/user_prefs.template;/usr/share/spamassassin/user_prefs.template
The following two sections detail the tagging that takes place for spam messages, first of all, and for non-spam messages.
Note that if you use the -t argument, all mails will be tagged as if they are spam messages.
The modifications made are as follows:
*****SPAM*****
is prepended to the subject,
unless the rewrite_subject 0
configuration option is given.
Yes, hits=nn required=nn
is set in this header to reflect
the filter status.
YES
.
report_header 1
configuration option is given.
text/plain
, in order to defang HTML mail or other active
content that could ``call back'' to the spammer.
report_header 1
configuration option is given.
No, hits=nn required=nn
is set in this header to reflect
the filter status.
Quite often, if you've been on the internet for a while, you'll have accumulated a few old email accounts that nowadays get nothing but spam.
SpamAssassin lets you set them up as aliases, as follows:
This will add any incoming mail messages straight into spam-tracking databases, such as Vipul's Razor; send an explanatory reply message to the sender, from the spamtrap1 address; then drop the mail into the bit-bucket.
The explanatory reply text is taken from the SpamAssassin configuration file,
where it is stored in the spamtrap
lines.
If you want to keep a copy of the mails, use something like this:
It is suggested you familiarise yourself with how MTAs run programs specified in aliases, if you plan to do this; for one thing, spamassassin will not run under your user id in this case. If you are nervous about this, create a user for spamtrapping, and set up spamassassin in its .forward file.
The spamassassin command is part of the Mail::SpamAssassin Perl module.
Install this as a normal Perl module, using perl -MCPAN -e shell
, or by
hand.
No environment variables, aside from those used by perl, are required to be set.
Mail::SpamAssassin(3)
Mail::SpamAssassin::Conf(3)
Mail::Audit(3)
Razor(3)
Justin Mason <jm /at/ jmason.org>
Mail::Audit
Net::DNS
Razor