spamc - client for spamd

spamc [options] < message

Client half of the spamc/spamd pair, used in place of "spamassassin" in scripts to process mail.
Reads mail from STDIN, spools to spamd,
then reads the result and displays it to STDOUT.

OPTIONS

-F file
--config=path
configuration file to read additional command-line flags from.
-u un
--username=un
Use per-user-config files, run spamc as the user whose config files spamd should load; by default the effective user-ID is set to spamd.
-L type
--learntype=type
Send message to spamd for learning.
type is spam, ham or forget.
The exitcode for spamc will be 5 if the message was learned, or
6 if it was already learned.
-C type
--reporttype=type
Report or revoke a message to one of the configured collaborative filtering databases.
The type is either report or revoke.
spamd must run with --allow-tell or this is ignored.
-r
--full-spam
If the message is spam output the SpamAssassin report to stdout .
If the message is ham (non-spam), nothing will be printed.
The first line of the output is the message score and the threshold, in the format:
score/threshold
-R
--full
Output the SpamAssassin report text to stdout, for all messages.
-l
--log-to-stderr
Send log messages to stderr, instead of to the syslog.
-y
--tests
output the names of the tests hit to stdout, on one line, separated by commas.
-c
--check
Set exitcode to
  • 1 if message is spam,
  • 0 if not spam or processing failure occurs.
Display score/threshold to stdout (as integers) or 0/0 if there was an error.
Implies --exitcode.
-E
--exitcode
Filter according to the other options, set the exitcode to 1 if message is spam, 0 if not spam or processing failure occurs.
-x
--no-safe-fallback
Disables 'safe fallback' error-recovery, which passes through the unaltered message if an error occurs.
Instead, exit with an error code, and let the MTA queue up the mails for a retry later. See also "EXIT CODES".
This also disables the TCP fail-over behaviour of -d.
spamc < -- > spamd options
-d host[,host2]
--dest=host[host2]
In TCP/IP mode, connect to spamd server on host (default: localhost).

If host resolves to multiple addresses, spamc will fail-over to the next addresses if the first one cannot be connected to. It will first try all addresses of each host before tries the next host.
-x inhibits the fail-over .

-p port
--port=port
In TCP/IP mode, connect to spamd listening on port (default: 783).
-H
--randomize
For TCP/IP sockets, randomize the IP addresses returned for the hosts given by -d. This provides for a simple kind of load balancing. Max tries is 3
-U socketpath
--socket=path
Connect to "spamd" via UNIX domain socket socketpath instead of a TCP/IP connection.
This option is not supported on Win32 platforms.
--connect-retries=r Retry connecting to spamd r times. default 3
--retry-sleep=s Sleep for sleep s between attempts to connect to spamd. The default is 1 second.
-t s
--timeout=s
Timeout for spamc-to-spamd communications (default: 600, 0 disables).
If spamd takes longer than s seconds to reply,
spamc will abort the connection and the message will be returned unprocessed!
-s max_size
--max-size=bytes
Set the maximum message size, in bytes, which will be sent to spamd. (default: 500 000).
maximum is 256 000 000.
-S
--ssl
--ssl=sslv
If spamc and spamd were built with support for SSL, encrypt exchanges with SSL; sslv specifies the protocol version to use, one of "sslv2", "sslv3", "tlsv1", or "sslv23".
default, "sslv23", causes spamc to use a SSLv2 hello handshake then negotiate use of SSLv3 or TLSv1 protocol if the spamd server can accept it.
-V
--version
If built with SSL support, an additional line will be included example>
SpamAssassin Client version 3.0.0-rc4 compiled with SSL support (OpenSSL 0.9.7d 17 Mar 2004)
-K Perform a keep-alive check of spamd, instead of a full message check.
-z Use gzip compression to compress the mail message sent to "spamd".
useful when spamd is not on the same system.
Requires "zlib" being installed for "spamc" , and the "Compress::Zlib" perl module for spamd
--headers Perform a scan and limit rewriting to the message headers.
This makes a significant reduction in bandwidth usage, since the response from spamd will not include the body.
Only makes sense if "report_safe 0" in the scanning configuration on the remote end; with "report_safe 1", it is likely to result in corrupt messages.
-B
--bsmtp
Input is a single BSMTP-formatted message. Characters between the DATA line and the "lone-dot" line are sent to spamd.
Output of spamd will be placed in the same envelope
( SIZE extensions will cause problems).
-e command [args]
--pipe-to command [args]
pipe the output to command's standard input.
If the fork-and-exec fails mail will be lost.

If used, this must be the last command line option.
(not supported on Win32 platforms.)

-h
--help
 

CONFIGURATION FILE

Command line switches override settings in the configuration file.

-F will be used instead of spamc.conf in "SYSCONFDIR" (default: /etc/mail/spamassassin).
If file doesn't exist no configuration file will be read.

Example:

           # spamc global configuration file 
           # connect to "spamd.example.com", port 783
           -d spamd.example.com
           -p 783

           # max message size for scanning = 350k
           -s 350000
    

EXIT CODES

'safe fallback' mode always exits with an exit code if 0
If an error occurrs it will pass the message unchanged.

-c and -E exit code of 1 if the message is spam.

-xerror conditions related to communication between spamc and spamd will result in an error code.

           EX_USAGE        64  command line usage error
           EX_DATAERR      65  data format error
           EX_NOINPUT      66  cannot open input
           EX_NOUSER       67  addressee unknown
           EX_NOHOST       68  host name unknown
           EX_UNAVAILABLE  69  service unavailable
           EX_SOFTWARE     70  internal software error
           EX_OSERR        71  system error (e.g., can't fork)
           EX_OSFILE       72  critical OS file missing
           EX_CANTCREAT    73  can't create (user) output file
           EX_IOERR        74  input/output error
           EX_TEMPFAIL     75  temp failure; user is invited to retry
           EX_PROTOCOL     76  remote error in protocol
           EX_NOPERM       77  permission denied
           EX_CONFIG       78  configuration error 

See Also

spamd SpamAssassin Conf
See the README file in the spamd directory of the SpamAssassin distribution for more details.