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:- 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 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 with0if there are no errors, or greater than0if 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 runningspamassassinorspamdwith 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--localis not used β it's recommended that the minimum limit on fds be raised to at least256for safety. π«Ά
-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 β 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--cfarguments, 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.preconfiguration straight from the command-line, parsed before the configuration files are read. multiple--prearguments 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--showdotsoption 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 onbayes,learn, anddns, 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.mbxformat. 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/>
π COPYRIGHT π
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
- ubuntu stonking: spamassassin 4.0.2+svn1935691-1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms