LinuxCommandLibrary

rspamc

Communicate with the Rspamd spam filter

TLDR

Train the bayesian filter to recognise an email as spam

$ rspamc learn_spam [path/to/email_file]
copy

Train the bayesian filter to recognise an email as ham
$ rspamc learn_ham [path/to/email_file]
copy

Generate a manual report on an email
$ rspamc symbols [path/to/email_file]
copy

Show server statistics
$ rspamc stat
copy

SYNOPSIS

rspamc [options]

PARAMETERS

-h, --help
    Show help message and exit.

-v, --verbose
    Enable verbose output.

-d, --debug
    Enable debug output.

-q, --quiet
    Disable non-error output.

-u , --url
    Specify the rspamd URL (default: http://localhost:11333).

-t , --timeout
    Set the timeout in seconds (default: 10).

-H , --header
    Add custom header to the request.

-f , --file
    Read message from file (or standard input if - is used).

-e, --exit-code
    Set exit code according to spam status (0 if not spam).

-r, --raw
    Print raw rspamd output.

-c, --check
    Check a file instead of sending a message (used for rspamd_proxy protocol).

-V, --version
    Show program version and exit.

DESCRIPTION

rspamc is a command-line client used to communicate with a running rspamd instance. Rspamd is a fast, free and open-source spam filtering system. rspamc allows users and other applications to send messages to rspamd for spam checking and classification. It can be used to check single messages, check files containing multiple messages, or even act as a filter in a mail pipeline. The client sends messages to rspamd over TCP and receives the results, including spam scores, symbols, and actions to take. This information can then be used by the caller to determine how to handle the email. Using rspamc requires a rspamd server to be running and configured.

<B>EXAMPLES</B>

1. Check a message from a file:
rspamc -f /path/to/email.txt

2. Check a message from standard input:
cat /path/to/email.txt | rspamc

3. Set exit code based on spam status:
rspamc -f /path/to/email.txt -e

4. Use a custom rspamd URL:
rspamc -u http://myserver:11333 -f /path/to/email.txt

5. Check a file using rspamd_proxy protocol:
rspamc -c -f /path/to/email.txt

SEE ALSO

rspamd(1)

Copied to clipboard