rspamc
Communicate with the Rspamd spam filter
TLDR
Train the bayesian filter to recognise an email as spam
Train the bayesian filter to recognise an email as ham
Generate a manual report on an email
Show server statistics
SYNOPSIS
rspamc [options] command [arguments]
Common commands:
check [filename]: Check a message for spam.
learn_spam [filename]: Teach Rspamd that a message is spam.
learn_ham [filename]: Teach Rspamd that a message is ham.
add_symbol <symbol>: Add a custom symbol to the learning database.
del_symbol <symbol>: Delete a custom symbol from the learning database.
stat: Show statistics about the Rspamd daemon.
status: Show basic status of the Rspamd daemon.
symbols: List all available Rspamd symbols.
PARAMETERS
-h, --help
Show a help message and exit.
-P, --port <port>
Connect to the specified port (default: 11333).
-H, --host <hostname>
Connect to the specified host (default: localhost).
-u, --url <url>
Connect to a specific Rspamd HTTP API URL.
-p, --password <password>
Password for authenticated commands (e.g., learn, symbol management).
-d, --deliver-to <recipient>
Specify the recipient for the email (used for per-user settings).
-i, --ip <sender_ip>
Specify the sender's IP address.
-s, --sender <sender_email>
Specify the sender's email address.
-v, --verbose
Enable verbose output.
-C, --config-file <path>
Path to the rspamc configuration file.
-j, --json
Output results in JSON format.
-f, --file <path>
Read message from specified file instead of stdin.
-c, --command <command>
Specify the command to execute (alternative to positional argument).
DESCRIPTION
rspamc is the command-line client for the Rspamd spam filtering system.
It allows users and scripts to interact with the Rspamd daemon to perform various operations, including checking messages for spam, learning from messages (marking them as spam or ham), managing custom symbols, and querying the daemon's operational status and statistics.
It's commonly used in mail processing pipelines to integrate Rspamd's powerful and highly performant filtering capabilities, often reading email content from standard input or a file and returning results in a human-readable format or structured JSON for automated processing.
CAVEATS
rspamc requires a running Rspamd daemon to function.
Authentication (using -p/--password) is necessary for sensitive commands like learn_spam, learn_ham, add_symbol, and del_symbol, unless the Rspamd configuration explicitly allows unauthenticated access from the client's IP.
Ensure proper network connectivity and firewall rules if connecting to a remote Rspamd instance.
INPUT AND OUTPUT
rspamc can read email messages from standard input (stdin) or from a specified file using the -f option.
For example, to check an email file: cat email.eml | rspamc check
or rspamc check email.eml
.
Output can be displayed in a human-readable format or in machine-parseable JSON format using the -j option, which is useful for scripting and integration with other systems.
HISTORY
Rspamd was initially developed by Vsevolod Stakhov as a performant, open-source spam filtering system, designed as a modern alternative to SpamAssassin.
Its development focuses on high performance, flexibility, and extensibility, leveraging technologies like C, Lua, and libev.
rspamc emerged as the primary command-line interface for interacting with the Rspamd daemon, reflecting its modular architecture and client-server design.