SPAMASSASSIN-RUN(1p)

πŸ’– spamassassin β€” NAME πŸ’–

okay so bestie, welcome to spamassassin, a simple front-end filtering script for SpamAssassin. she's the friendly lil doorway, the whole SpamAssassin engine is behind her ✨

this page lives in the User Contributed Perl Documentation section, SPAMASSASSIN-RUN(1p), and she's the run one β€” the actual command you type. iykyk πŸ’…


🌸 SYNOPSIS 🌸

the ✨ shapes ✨ she can take:

spamassassin [options] [ < mailmessage | path ... ]
spamassassin -d [ < mailmessage | path ... ]
spamassassin -r [ < mailmessage | path ... ]
spamassassin -k [ < mailmessage | path ... ]
spamassassin -W|-R [ < mailmessage | path ... ]

πŸŽ€ Options πŸŽ€

okay the full menu, no cap, every single one:

  • -L, --local β€” local tests only, no online tests. offline queen energy 🧚
  • -r, --report β€” report the message as spam
  • -k, --revoke β€” revoke the message as spam
  • -d, --remove-markup β€” strip the spam reports off a message
  • -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 (default: /etc/spamassassin)
  • --cf='config line' β€” one extra line of configuration
  • --pre='config line' β€” one extra line of ".pre" (prepended right to the front of the configuration) πŸ’…
  • -x, --nocreate-prefs β€” do NOT create the user preferences file
  • -e, --exit-code β€” exit with a non-zero exit code if the tested message was spam
  • --mbox β€” read messages in mbox format
  • --mbx β€” read messages in UW mbx format
  • -t, --test-mode β€” pipe the message through and slap an extra report onto the bottom
  • --lint β€” lint the rule set, aka report syntax errors 🧐
  • -W, --add-to-welcomelist β€” add addresses found in the mail to the persistent address welcomelist
  • --add-to-blocklist β€” add addresses found in the mail to the persistent address blocklist
  • -R, --remove-from-welcomelist β€” remove all addresses found in the 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. that's it, that's the vibe, she's the little door you knock on πŸ’–

using the SpamAssassin rule base, she runs a wide range of heuristic tests on your mail headers and body text to sniff out "spam" β€” also known as unsolicited bulk email. once she's clocked it, the mail gets tagged as spam so your own mail user-agent application can filter it later. main character energy fr fr ✨

the default tagging operations that happen are all written out in "TAGGING" in spamassassin.

by default, message(s) come in from STDIN (< mailmessage), or from the files and directories you name (path ...). STDIN and files are assumed to be in file format, one single message per file. directories are assumed to be in a format where every file in the directory holds only one message β€” and listen, bestie:

  • directories are not recursed πŸ™ˆ
  • filenames containing whitespace are skipped
  • filenames beginning with . or , are skipped too

the --mbox and --mbx options can override that assumed format β€” peep the OPTION info below for the details πŸ‘€

files compressed with gzip/bzip2/xz/lz4/lzip/lzo get uncompressed automatically, no manual work needed 🫢. more details live in "Mail::SpamAssassin::ArchiveIterator".

⚠️ okay serious moment β€” please note that 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. she will simply eat your RAM and not feel bad about it πŸ’€

✨ OPTIONS ✨

okay bestie, here's where the real fun starts. every flag, every vibe, no skips πŸ’…

  • -e, --error-code, --exit-code β€” bail out with a non-zero error code if the message turns out to be spam. yes, that's the drama you asked for.
  • -h, --help β€” print the help message and dip out. classic.
  • -V, --version β€” print the version and bounce.
  • -t, --test-mode β€” test mode!! pipes your message through and slaps an extra report on it. heads up though: the report text is written assuming the message is spam, since in normal use you'd only ever see it in that case. so don't trust the words, trust the score, bestie. πŸ‘‘

if you run this with -d, the message will first have its SpamAssassin markup removed before being tested. cute, clean, tested.

if the message has SpamAssassin markup in it, that markup gets stripped automatically before submission. and listen β€” the support modules for DCC, Pyzor, and Razor must be installed for spam to be reported to each service. SpamCop reports hit way 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). (ngl, if you only wanna do statistical learning and you do not wanna report mail to third parties, you should just use the sa-learn command directly instead. it's giving efficiency.)

  • -k, --revoke β€” takin' it back πŸ™ˆ revokes the mail message read from STDIN from various spam-blocker databases. currently that's Vipul's Razor.

revocation support for the Distributed Checksum Clearinghouse, Pyzor, and SpamCop is not currently available. sorry babes.

if the message has SpamAssassin markup, it gets stripped automatically before submission. and 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; right now that's the internal Bayesian statistical-filtering system (the BAYES rules). (same note as before: if you only want statistical learning and don't want to report mail to third-parties, go use the sa-learn command directly.)

  • --lint β€” syntax check (lint) the rule set and 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. it's basically a vibe check for your config πŸ’…
  • -W, --add-to-welcomelist β€” previously --add-to-whitelist, which will still work interchangeably until 4.1.

adds all email addresses found in the headers and 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 still work interchangeably until 4.1.

adds all email addresses in the headers and 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 still work interchangeably until 4.1.

removes all email addresses in the headers and body of the mail message read from STDIN from a persistent address list. STDIN must contain a full email message, so if you just wanna remove a single address you should use --remove-addr-from-welcomelist instead. iykyk ✨

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 still work interchangeably until 4.1.

adds 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 still work interchangeably until 4.1.

adds 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 still work interchangeably until 4.1.

removes 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 β€” removes 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 you specify this, the username overrides whatever was 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 that 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 tries to detect if IPv6 is available and uses only IPv4 if it's not. use this if the existing tests for IPv6 availability produce incorrect results or crashes. lowkey a rescue flag.
  • -L, --local β€” only do 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 if you want faster checks, this is the move.

heads up: 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 β€” removes 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 won't be exactly identical β€” some headers will be reformatted due 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. multiple --cf arguments can be used, and each one gets treated as a 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 gets treated as a 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 behaves 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 is 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 user preferences file. no new files, no drama.
  • --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 a wrap bestie!! 🫢 this whole thing is perl v5.40.1, dated 2026-07-23, and it's SPAMASSASSIN-RUN(1p) β€” go forth and filter, you absolute icon βœ¨πŸ’–

πŸ“¦ where this page comes from