spamassassin-run(3pm)

hey bestie! welcome to the spamassassin-run(3pm) page from the User Contributed Perl Documentation set. this is part 1, and we're about to make Unix make sense, fr fr. 🫢

✨ NAME ✨

spamassassin β€” simple front-end filtering script for SpamAssassin. that's it, that's the name, and it's iconic. πŸ‘‘

🌸 SYNOPSIS 🌸

okay so here's how you call it:

spamassassin [options] [ < mailmessage | path ... ]

spamassassin -d [ < mailmessage | path ... ]

spamassassin -r [ < mailmessage | path ... ]

spamassassin -k [ < mailmessage | path ... ]

spamassassin -W|-R [ < mailmessage | path ... ]

Options:

  • -L, --local β€” local tests only, no online tests. like, stay offline, bestie. πŸ’…
  • -r, --report β€” report the message as spam. 🚨
  • -k, --revoke β€” revoke the message as spam. undo, undo! ↩️
  • -d, --remove-markup β€” remove spam reports from a message. clean slate ✨
  • -C path, --configpath=path, --config-file=path β€” path to the standard configuration dir.
  • -p prefs, --prefspath=file, --prefs-file=file β€” set the user preferences file.
  • --siteconfigpath=path β€” path for site configs (def: /etc/spamassassin).
  • --cf='config line' β€” an additional line of configuration.
  • --pre='config line' β€” an additional line of .pre (prepended to configuration).
  • -x, --nocreate-prefs β€” don't create the user preferences file.
  • -e, --exit-code β€” exit with a non-zero exit code if the tested message was spam.
  • --mbox β€” read in messages in mbox format.
  • --mbx β€” read in messages in UW mbx format.
  • -t, --test-mode β€” pipe message through and add an extra report to the bottom.
  • --lint β€” lint the rule set: report syntax errors.
  • -W, --add-to-welcomelist β€” add addresses in mail to the persistent address welcomelist.
  • --add-to-blocklist β€” add addresses in mail to the persistent address blocklist.
  • -R, --remove-from-welcomelist β€” remove all addresses found in mail from the persistent address list.
  • --add-addr-to-welcomelist=addr β€” add addr to the persistent address welcomelist.
  • --add-addr-to-blocklist=addr β€” add addr to the persistent address blocklist.
  • --remove-addr-from-welcomelist=addr β€” remove addr from the persistent address welcomelist.
  • --remove-addr-from-blocklist=addr β€” remove addr from the persistent address blocklist.
  • -u username, --username=username β€” override the username taken from the runtime environment, used with SQL.
  • -4 --ipv4only, --ipv4-only, --ipv4 β€” use IPv4, disable use of IPv6 for DNS etc.
  • -6 β€” use IPv6, disable use of IPv4 where possible.
  • --progress β€” print a progress bar.
  • -D, --debug [area,...] β€” print debugging messages.
  • -V, --version β€” print version.
  • -h, --help β€” print usage message.

πŸ’– DESCRIPTION πŸ’–

spamassassin is a simple front-end filter for SpamAssassin. no cap.

Using the SpamAssassin rule base, it runs a wide range of heuristic tests on mail headers and body text to identify "spam", also known as unsolicited bulk email. once it's identified, the mail gets tagged as spam for later filtering using the user's own mail user-agent application. it's giving personal assistant but for your inbox. πŸ’…

The default tagging operations that take place are detailed in "TAGGING" in spamassassin.

By default, message(s) are read in from STDIN (< mailmessage), or from specified files and directories (path ...). STDIN and files are assumed to be in file format, with a single message per file. Directories are assumed to be in a format where each file in the directory contains only one message (directories are not recursed and filenames containing whitespace or beginning with . or , are skipped). The options --mbox and --mbx can override the assumed format β€” see the appropriate OPTION information below.

Files compressed with gzip/bzip2/xz/lz4/lzip/lzo are uncompressed automatically. See Mail::SpamAssassin::ArchiveIterator for more details.

⚠️ bestie, please note: SpamAssassin is not designed to scan huge messages. Messages larger than ~10-20MB should not be fed to SpamAssassin, because memory consumption will increase rapidly. don't do it, it's not the vibe. 😭

🌸 OPTIONS 🌸

bestie, this is the section. the whole menu of what you can tell spamassassin to do. buckle up πŸ’–

  • -e, --error-code, --exit-code β€” if the message turns out to be spam, exit with a non-zero error code. that's it, that's the whole job ✨
  • -h, --help β€” print the help message and dip. 🫢
  • -V, --version β€” print the version and dip. iconic.
  • -t, --test-mode β€” test mode. pipes the message through and adds an extra report. ⚠️ heads up: the report text is written assuming the message is spam (because normally you'd only ever see it in that case), so look at the score, not the report. and if you run this together with -d, the message gets its SpamAssassin markup stripped off first, before it gets tested.
  • -r, --report β€” report this message as manually-verified spam 😀. this submits the mail message read from STDIN to various spam-blocker databases. currently those are:

if the message has SpamAssassin markup in it, that markup gets stripped out automatically before submission. the support modules for DCC, Pyzor, and Razor must be installed for spam to actually be reported to each service. SpamCop reports hit harder if you register and set the spamcop_to_address option.

the message also gets submitted to SpamAssassin's learning systems β€” right now that's the internal Bayesian statistical-filtering system (the BAYES rules). (not me being the responsible one: if you only want statistical learning and you do not want to report mail to third-parties, you should use the sa-learn command directly instead πŸŽ€)

  • -k, --revoke β€” revoke this message. this revokes the mail message read from STDIN from various spam-blocker databases. currently that's just Vipul's Razor.

revocation support for the Distributed Checksum Clearinghouse, Pyzor, and SpamCop is not currently available. πŸ’€

if the message has SpamAssassin markup, the markup gets stripped out automatically before submission. the support modules for Razor must be installed for spam to be revoked from the service.

the message also gets submitted as 'ham' (non-spam) to SpamAssassin's learning systems β€” currently the internal Bayesian statistical-filtering system (the BAYES rules). (again bestie: if you only want statistical learning and don't want to report mail to third-parties, use the sa-learn command directly instead.)

  • --lint β€” syntax check (lint) the rule set and the configuration files, reporting typos and rules that don't compile correctly. exits with 0 if there are no errors, or greater than 0 if any errors are found. ✨ the vibe check for your config ✨
  • -W, --add-to-welcomelist β€” previously --add-to-whitelist, which will work interchangeably until 4.1.

add all email addresses (in the headers and the body) of the mail message read from STDIN to a persistent address welcomelist. note that you must be running spamassassin or spamd with a persistent address list plugin enabled for this to work.

  • --add-to-blocklist β€” previously --add-to-blacklist, which will work interchangeably until 4.1.

add all email addresses (in the headers and the body) of the mail message read from STDIN to the persistent address blocklist. note that you must be running spamassassin or spamd with a persistent address list plugin enabled for this to work.

  • -R, --remove-from-welcomelist β€” previously --remove-from-whitelist, which will work interchangeably until 4.1.

remove all email addresses (in the headers and the body) of the mail message read from STDIN from a persistent address list. STDIN must contain a full email message, so to remove just a single address you should use --remove-addr-from-welcomelist instead. 🫢

note that you must be running spamassassin or spamd with a persistent address list plugin enabled for this to work.

  • --add-addr-to-welcomelist β€” previously --add-addr-to-whitelist, which will work interchangeably until 4.1.

add the named email address to a persistent address welcomelist. note that you must be running spamassassin or spamd with a persistent address list plugin enabled for this to work.

  • --add-addr-to-blocklist β€” previously --add-addr-to-blacklist, which will work interchangeably until 4.1.

add the named email address to a persistent address blocklist. note that you must be running spamassassin or spamd with a persistent address list plugin enabled for this to work.

  • --remove-addr-from-welcomelist β€” previously --remove-addr-from-whitelist, which will work interchangeably until 4.1.

remove the named email address from a persistent address welcomelist. note that you must be running spamassassin or spamd with a persistent address list plugin enabled for this to work.

  • --remove-addr-from-blocklist β€” remove the named email address from a persistent address blocklist. note that you must be running spamassassin or spamd with a persistent address list plugin enabled for this to work.
  • -u username, --username=username β€” if specified, this username overrides the username taken from the runtime environment. you can use this option to specify users in a virtual user configuration when using SQL as the Bayes backend.
NOTE: this option will not change to the given username β€” it will only attempt to act on behalf of that user. because of this you'll need proper permissions to be able to change files owned by username. in the case of SQL this generally is not a problem. πŸ’…
  • --ipv4only, --ipv4-only, --ipv4 β€” do not use IPv6 for DNS tests. normally SpamAssassin will try to detect whether IPv6 is available, using only IPv4 if it isn't. use this if the existing tests for IPv6 availability produce incorrect results or crashes. πŸ”₯
  • -L, --local β€” do only the ''local'' tests, the ones that don't need an internet connection to operate. normally SpamAssassin tries to detect whether you're connected to the net before doing these tests anyway, but for faster checks you may wish to use this.
note that SpamAssassin's network rules run in parallel. this can cause overhead in terms of the number of file descriptors required if --local is not used β€” it's recommended that the minimum limit on fds be raised to at least 256 for safety. 🫢
  • -d, --remove-markup β€” remove SpamAssassin markup (the "SpamAssassin results" report, X-Spam-Status headers, etc.) from the mail message. the resulting message β€” which will be more or less identical to the original, pre-SpamAssassin input β€” gets output to STDOUT.
(note: the message will not be exactly identical; some headers get reformatted thanks to some features of the Mail::Internet package, but the body text will be.) πŸ¦‹
  • -C path, --configpath=path, --config-file=path β€” use the specified path for locating the distributed configuration files. ignore the default directories (usually "/usr/share/spamassassin" or similar).
  • --siteconfigpath=path β€” use the specified path for locating site-specific configuration files. ignore the default directories (usually "/etc/spamassassin" or similar).
  • --cf='config line' β€” add extra lines of configuration straight from the command-line, parsed after the configuration files are read. you can use multiple --cf arguments, and each one counts as its own separate line of configuration. for example:
spamassassin -t --cf="body NEWRULE /text/" --cf="score NEWRULE 3.0"
  • --pre='config line' β€” add extra lines of .pre configuration straight from the command-line, parsed before the configuration files are read. multiple --pre arguments can be used, and each one counts as its own separate line of configuration. for example:
spamassassin -t --pre="loadplugin Mail::SpamAssassin::Plugin::Foobar"
  • -p prefs, --prefspath=prefs, --prefs-file=prefs β€” read user score preferences from prefs (usually "$HOME/.spamassassin/user_prefs").
  • --progress β€” prints a progress bar (to STDERR) showing the current progress. this option is only useful if you're redirecting STDOUT (and not STDERR). in the case where no valid terminal is found, this option will behave very much like the --showdots option in other SpamAssassin programs. πŸ‘‘
  • -D [area,...], --debug [area,...] β€” produce debugging output. if no areas are listed, all debugging information gets printed. diagnostic output can also be enabled for each area individually; area is the area of the code to instrument. for example, to produce diagnostic output on bayes, learn, and dns, use:
spamassassin -D bayes,learn,dns

use an empty string (-D '') to indicate no areas when the next item on the command line is a path, so the path doesn't get parsed as an area.

higher-priority informational messages that are suitable for logging in normal circumstances are available with an area of "info".

for more info about which areas (also known as channels) are available, please see the documentation at:

L<https://wiki.apache.org/spamassassin/DebugChannels>
  • -x, --nocreate-prefs β€” disable creation of the user preferences file. πŸ™ˆ
  • --mbox β€” specify that the input message(s) are in mbox format. mbox is a standard Unix message folder format.
  • --mbx β€” specify that the input message(s) are in UW .mbx format. mbx is the mailbox format used within the University of Washington's IMAP implementation; see "https://en.wikipedia.org/wiki/UW_IMAP".

🌈 SEE ALSO 🌈

sa-learn(1) spamd(1) spamc(1) Mail::SpamAssassin::Conf(3) Mail::SpamAssassin(3)

✨ PREREQUISITES ✨

"Mail::SpamAssassin"

πŸ’€ BUGS πŸ’€

See <https://bz.apache.org/SpamAssassin/>

πŸ‘‘ AUTHORS πŸ‘‘

The SpamAssassin(tm) Project <https://spamassassin.apache.org/>

SpamAssassin is distributed under the Apache License, Version 2.0, as described in the file "LICENSE" included with the distribution.


and that's the whole page bestie, no cap πŸ’œ this one came to you from perl v5.40.1, dated 2026-07-23, filed under spamassassin-run(3pm) β€” go forth and filter, you absolute icon πŸŒΈβœ¨πŸ¦‹

πŸ“¦ where this page comes from