spamc - client for spamd
Spamc is the client half of the spamc/spamd pair. It should be used in place
of spamassassin
in scripts to process mail. It will read the mail from
STDIN, and spool it to its connection to spamd, then read the result back and
print it to STDOUT. Spamc has extremely low overhead in loading, so it should
be much faster to load than the whole spamassassin program.
See the README file in the spamd directory of the SpamAssassin distribution for more details.
All options detailed below can be passed as command line arguments, or be contained in a configuration file, as described in the CONFIGURATION FILE section below.
Note that the long options, a la --long-options
, are new as of
SpamAssassin 3.2.0, and were not available in earlier versions.
If host resolves to multiple addresses, then spamc will fail-over to the other addresses, if the first one cannot be connected to. It will first try all addresses of one host before it tries the next one in the list. Note that this fail-over behaviour is incompatible with -x; if that switch is used, fail-over will not occur.
Note that this must be the LAST command line option, as everything after the -e is taken as arguments to the command (it's like rxvt or xterm).
This option is not supported on Win32 platforms.
learn type
can be either spam,
ham or forget. The exitcode for spamc will be set to 5 if the message
was learned, or 6 if it was already learned.
Note that the spamd
must run with the --allow-tell
option for
this to work.
report type
can be either report or revoke.
Note that the spamd
must run with the --allow-tell
option for
this to work.
score/threshold
The size is specified in bytes, as a positive integer greater than 0. For example, -s 500000.
sslv2
, sslv3
, tlsv1
, or sslv23
. The 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.
spamd
via UNIX domain socket socketpath instead of a
TCP/IP connection.
This option is not supported on Win32 platforms.
spamc
client. If built with SSL support,
an additional line will be included noting this, like so:
SpamAssassin Client version 3.0.0-rc4 compiled with SSL support (OpenSSL 0.9.7d 17 Mar 2004)
This also disables the TCP fail-over behaviour from -d.
spamd
. This is
useful for long-distance use of spamc over the internet. Note that this relies
on zlib
being installed on the spamc
client side, and the
Compress::Zlib
perl module on the server side; an error will be returned
otherwise.
Note that this only makes sense if you are using report_safe 0
in the
scanning configuration on the remote end; with report_safe 1
, it is
likely to result in corrupt messages.
The above command-line switches can also be loaded from a configuration file.
The format of the file is similar to the SpamAssassin rules files; blank lines
and lines beginning with #
are ignored. Any space-separated words are
considered additions to the command line, and are prepended. Newlines are
treated as equivalent to spaces. Existing command line switches will override
any settings in the configuration file.
If the -F switch is specified, that file will be used. Otherwise,
spamc
will attempt to load spamc.conf in SYSCONFDIR
(default:
/etc/mail/spamassassin). If that file doesn't exist, and the -F
switch is not specified, no configuration file will be read.
Example:
# spamc global configuration file # connect to "server.example.com", port 783 -d server.example.com -p 783
# max message size for scanning = 350k -s 350000
By default, spamc will use the 'safe fallback' error recovery method. That
means, it will always exit with an exit code if 0
, even if an error was
encountered. If any error occurrs, it will simply pass through the unaltered
message.
The -c and -E options modify this; instead, spamc will use an exit code
of 1
if the message is determined to be spam.
If the -x
option is specified, 'safe fallback' will be disabled, and certain
error conditions related to communication between spamc and spamd will result
in an error code. The exit codes used are as follows:
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
spamd(1)
spamassassin(1)
Mail::SpamAssassin(3)
Mail::SpamAssassin
The SpamAssassin(tm)
Project <http://spamassassin.apache.org/>
SpamAssassin is distributed under the Apache License, Version 2.0, as
described in the file LICENSE
included with the distribution.