SPAMASSASSIN-RUN(1)

๐Ÿ’Œ SPAMASSASSIN-RUN(1) ๐Ÿ’Œ

okay so this is the manual page for spamassassin-run, straight out of User Contributed Perl Documentation, and bestie, it's literally the gateway to the whole SpamAssassin vibe. it's a simple front-end filtering script for SpamAssassin, and by the end of this you're gonna be filtering spam like it's main character energy. let's go โœจ


๐ŸŽ€ NAME ๐ŸŽ€

spamassassin โ€” the simple front-end filtering script for SpamAssassin. that's it, that's the name, she's iconic ๐Ÿ’…


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

okay so here's the group chat of every way you can call her:

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

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

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

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

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

and now the options, because there are so many and every single one matters:

  • -L, --local โ€” local tests only, no online tests. keeping it cozy and offline ๐Ÿ 
  • -r, --report โ€” report the message as spam. snitch on it, fr fr ๐Ÿ“ข
  • -k, --revoke โ€” revoke the message as spam. nvm bestie, our bad ๐Ÿ™ˆ
  • -d, --remove-markup โ€” remove spam reports from a message. cleanup era ๐Ÿงน
  • -C path, --configpath=path, --config-file=path โ€” the path to the standard configuration dir ๐Ÿ“
  • -p prefs, --prefspath=file, --prefs-file=file โ€” set the user preferences file. your personal settings, your rules ๐Ÿ’–
  • --siteconfigpath=path โ€” path for site configs (default: /etc/mail/spamassassin) ๐Ÿ—‚๏ธ
  • --cf='config line' โ€” one more line of configuration, right there on the command line โšก
  • --pre='config line' โ€” one more line of .pre config, and yup, it gets prepended to the configuration ๐Ÿ‘‘
  • -x, --nocreate-prefs โ€” don't create the user preferences file. no new files today ๐Ÿšซ
  • -e, --exit-code โ€” exit with a non-zero exit code if the tested message was spam. so scripts can tell ๐Ÿ‘€
  • --mbox โ€” read in messages in mbox format ๐Ÿ“ฌ
  • --mbx โ€” read in messages in UW mbx format ๐Ÿ“ฎ
  • -t, --test-mode โ€” pipe the message through and add an extra report to the bottom ๐Ÿงช
  • --lint โ€” lint the rule set: report syntax errors. spa day for your rules โœจ
  • -W, --add-to-welcomelist โ€” add addresses in the mail to the persistent address welcomelist ๐Ÿ’š
  • --add-to-blocklist โ€” add addresses 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. old school but reliable ๐ŸŒˆ
  • -6 โ€” use IPv6, disable use of IPv4 where possible. future era ๐Ÿš€
  • --progress โ€” print a progress bar. we love a little visual ๐Ÿ“
  • -D, --debug [area,...] โ€” print debugging messages. peek behind the curtain ๐Ÿ”
  • -V, --version โ€” print the version ๐Ÿท๏ธ
  • -h, --help โ€” print the usage message. when in doubt, ask her ๐Ÿซถ

๐ŸŒธ DESCRIPTION ๐ŸŒธ

okay so spamassassin is a simple front-end filter for SpamAssassin. simple in the way that a perfectly executed fit is "simple", ykwim? ๐Ÿ’…

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, which is literally the worst genre of email ever. once it's identified, the mail gets tagged as spam for later filtering using the user's own mail user-agent application. slay ๐ŸŽ€

the default tagging operations that take place are detailed in "TAGGING" in spamassassin โ€” that's where the receipts live, bestie, go read it.

so 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 โ€” one message per file, that's the rule ๐Ÿ“„. directories are assumed to be in a format where each file in the directory contains only one message. and listen, directories are not recursed, and filenames containing whitespace or beginning with . or , are skipped. so if your file is named my spam.txt or .hidden or ,comma, she's not seeing it, periodt ๐Ÿ™ˆ. the options --mbox and --mbx can override the assumed format, so check the appropriate OPTION info below.

files compressed with gzip/bzip2/xz/lz4/lzip/lzo are uncompressed automatically. so thoughtful of her ๐Ÿงš. see "Mail::SpamAssassin::ArchiveIterator" for more details.

โš ๏ธ ok important warning bestie: 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 and that's not a vibe, that's a crash waiting to happen ๐Ÿ˜ญ

okay that's the setup, and there's so much more coming โ€” the deep dive continues, so stay with me ๐Ÿฆ‹

โœจ OPTIONS โœจ

okay bestie, here's the full menu of flags โ€” every single one, no skips ๐Ÿ’…

  • -e, --error-code, --exit-code โ€” bail out with a non-zero error code if the message gets flagged as spam. that's it, that's the whole vibe ๐Ÿซถ
  • -h, --help โ€” prints the help message and dips. iconic behavior honestly โœจ
  • -V, --version โ€” prints the version and exits. quick little flex ๐Ÿ’–
  • -t, --test-mode โ€” test mode, queen. pipes the message through and adds the extra report. ๐ŸŽ€ heads up tho: the report text assumes the message is spam, since in normal use you'd only ever see it in that case โ€” so don't trust the wording, pay attention to the score instead ๐Ÿ‘‘

and if you run this together with -d, the message will first have SpamAssassin markup removed before being tested. teamwork! ๐Ÿงš

if the message contains SpamAssassin markup, that markup gets stripped out automatically before submission. the support modules for DCC, Pyzor, and Razor must be installed for spam to be reported to each service. and SpamCop reports will have greater effect if you register and set the spamcop_to_address option, so likeโ€ฆ do that ๐Ÿ’…

the message will also be submitted to SpamAssassin's learning systems; currently this is the internal Bayesian statistical-filtering system (the BAYES rules). (note: if you only want to perform statistical learning, and do not want to report mail to third-parties, you should use the sa-learn command directly instead. iykyk ๐Ÿฆ‹)

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

revocation support for the Distributed Checksum Clearinghouse, Pyzor, and SpamCop is not currently available ๐Ÿ˜ญ that's just how it is rn.

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

the message will also be submitted as 'ham' (non-spam) to SpamAssassin's learning systems; currently this is the internal Bayesian statistical-filtering system (the BAYES rules). (note: if you only want to perform statistical learning, and do not want to report mail to third-parties, you should use the sa-learn command directly instead. same note as before, still true ๐ŸŒธ)

  • --lint โ€” syntax check (lint) the rule set and configuration files, reporting typos and rules that do not 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 fr fr โœ…
  • -W, --add-to-welcomelist โ€” previously --add-to-whitelist, which will work interchangeably until 4.1. ๐Ÿ“

adds all email addresses, 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. no plugin, no party ๐Ÿ™ˆ

  • --add-to-blocklist โ€” previously --add-to-blacklist, which will 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 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 to remove a single address you should use --remove-addr-from-welcomelist instead. important distinction bestie ๐Ÿ’€

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.

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 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 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. (no "previously" note on this one, she's new here โœจ)
  • -u username, --username=username โ€” if specified, this username will override 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 will need to have proper permissions to be able to change files owned by username. in the case of SQL this generally is not a problem. main character energy but with the right permissions, yk? ๐Ÿ‘‘
  • --ipv4only, --ipv4-only, --ipv4 โ€” do not use IPv6 for DNS tests. normally, SpamAssassin will try to detect if IPv6 is available, using only IPv4 if it is not. use this if the existing tests for IPv6 availability produce incorrect results or crashes. ๐Ÿ’€ three aliases, one job.
  • -L, --local โ€” do only the "local" tests, the ones that do not require an internet connection to operate. normally, SpamAssassin will try to detect whether you are connected to the net before doing these tests anyway, but for faster checks you may wish to use this. ๐Ÿ 
note: SpamAssassin's network rules are run in parallel. this can cause overhead in terms of the number of file descriptors required if --local is not used; it is recommended that the minimum limit on fds be raised to at least 256 for safety. protect your fds bestie ๐Ÿ˜ญ
  • -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, will be output to STDOUT. ๐Ÿงผ
(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.) don't come for me about the headers ๐Ÿ’…
  • -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/mail/spamassassin or similar). ๐Ÿ—„๏ธ
  • --cf='config line' โ€” add additional lines of configuration directly from the command-line, parsed after the configuration files are read. multiple --cf arguments can be used, and each will be considered a separate line of configuration. for example:
spamassassin -t --cf="body NEWRULE /text/" --cf="score NEWRULE 3.0"

obsessed with this one actually ๐Ÿ”ฅ

  • --pre='config line' โ€” add additional lines of .pre configuration directly from the command-line, parsed before the configuration files are read. multiple --pre arguments can be used, and each will be considered a separate line of configuration. for example:
spamassassin -t --pre="loadplugin Mail::SpamAssassin::Plugin::Foobar"

before vs after, know the difference ๐Ÿ’–

  • -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 will only be useful if you are 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. little loading bar moment โœจ
  • -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, to prevent the path from being parsed as an area. sneaky! ๐Ÿ˜ญ

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

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

L<https://wiki.apache.org/spamassassin/DebugChannels>

go read the wiki bestie ๐Ÿฆ‹

  • -x, --nocreate-prefs โ€” disable creation of user preferences file. sometimes you just don't want the file, periodt. ๐Ÿšซ
  • --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)

the whole friend group honestly ๐Ÿซถ


๐Ÿงš PREREQUISITES ๐Ÿงš

Mail::SpamAssassin โ€” that's the one, gotta have it ๐Ÿ’œ


๐Ÿ’€ BUGS ๐Ÿ’€

see <https://bz.apache.org/SpamAssassin/> โ€” yes there's a bug tracker, yes you should use it, no don't just suffer in silence ๐Ÿ˜ญ


๐Ÿ‘‘ 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.


k that's the whole page bestie, you're officially informed ๐Ÿ’…โœจ this was perl v5.42.0, dated 2025-08-31, page SPAMASSASSIN-RUN(1) โ€” go forth and filter some spam, you absolute icon ๐Ÿฆ‹๐ŸŒธ๐Ÿ’–

๐Ÿ“ฆ where this page comes from