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.preconfig, 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โ addaddrto the persistent address welcomelist โ--add-addr-to-blocklist=addrโ addaddrto the persistent address blocklist โ--remove-addr-from-welcomelist=addrโ removeaddrfrom the persistent address welcomelist ๐ง--remove-addr-from-blocklist=addrโ removeaddrfrom 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! ๐ง
-r,--reportโ reporting this message as manually-verified spam. this submits the mail message read from STDIN to various spam-blocker databases. currently these are the Distributed Checksum Clearinghouse "https://www.dcc-servers.net/dcc/", Pyzor "https://www.pyzor.org/", Vipul's Razor "http://razor.sourceforge.net/", and SpamCop "https://www.spamcop.net/". ๐จ
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 with0if there are no errors, or greater than0if any errors are found. the vibe check for your config fr fr โ-W,--add-to-welcomelistโ previously--add-to-whitelist, which will work interchangeably until4.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 until4.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 until4.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 until4.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 until4.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 until4.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 runningspamassassinorspamdwith 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--localis not used; it is recommended that the minimum limit on fds be raised to at least256for safety. protect your fds bestie ๐ญ
-d,--remove-markupโ remove SpamAssassin markup (the "SpamAssassin results" report,X-Spam-Statusheaders, 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/spamassassinor similar). ๐--siteconfigpath=pathโ use the specified path for locating site-specific configuration files. ignore the default directories (usually/etc/mail/spamassassinor similar). ๐๏ธ--cf='config line'โ add additional lines of configuration directly from the command-line, parsed after the configuration files are read. multiple--cfarguments 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.preconfiguration directly from the command-line, parsed before the configuration files are read. multiple--prearguments 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--showdotsoption 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/>
๐ COPYRIGHT ๐
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
- alpine 3.23: spamassassin-doc 4.0.2-r0 ยท Apache-2.0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms