1SPAMC(1)              User Contributed Perl Documentation             SPAMC(1)
2
3
4

NAME

6       spamc - client for spamd
7

SYNOPSIS

9       spamc [options] < message
10

DESCRIPTION

12       Spamc is the client half of the spamc/spamd pair.  It should be used in
13       place of "spamassassin" in scripts to process mail.  It will read the
14       mail from STDIN, and spool it to its connection to spamd, then read the
15       result back and print it to STDOUT.  Spamc has extremely low overhead
16       in loading, so it should be much faster to load than the whole
17       spamassassin program.
18
19       See the README file in the spamd directory of the SpamAssassin
20       distribution for more details.
21

OPTIONS

23       All options detailed below can be passed as command line arguments, or
24       be contained in a configuration file, as described in the CONFIGURATION
25       FILE section below.
26
27       Note that the long options, a la "--long-options", are new as of
28       SpamAssassin 3.2.0, and were not available in earlier versions.
29
30       -B, --bsmtp
31           Assume input is a single BSMTP-formatted message. In other words,
32           spamc will pull out everything between the DATA line and the lone-
33           dot line to feed to spamd, and will place the spamd output back in
34           the same envelope (thus, any SIZE extension in your BSMTP file will
35           cause many problems).
36
37       -c, --check
38           Just check if the message is spam or not.  Set process exitcode to
39           1 if message is spam, 0 if not spam or processing failure occurs.
40           Will print score/threshold to stdout (as ints) or 0/0 if there was
41           an error.  Combining -c and -E is a no-op, since -c implies the
42           behaviour of -E.
43
44       -d host[,host2], --dest=host[,host2]
45           In TCP/IP mode, connect to spamd server on given host (default:
46           localhost).  Several hosts can be specified if separated by commas.
47
48           If host resolves to multiple addresses, then spamc will fail-over
49           to the other addresses, if the first one cannot be connected to.
50           It will first try all addresses of one host before it tries the
51           next one in the list.  Note that this fail-over behaviour is
52           incompatible with -x; if that switch is used, fail-over will not
53           occur.
54
55       -e command [args], --pipe-to command [args]
56           Instead of writing to stdout, pipe the output to command's standard
57           input.  Note that there is a very slight chance mail will be lost
58           here, because if the fork-and-exec fails there's no place to put
59           the mail message.
60
61           Note that this must be the LAST command line option, as everything
62           after the -e is taken as arguments to the command (it's like rxvt
63           or xterm).
64
65           This option is not supported on Win32 platforms.
66
67       -E, --exitcode
68           Filter according to the other options, but set the process exitcode
69           to 1 if message is spam, 0 if not spam or processing failure
70           occurs.
71
72       -F /path/to/file, --config=path
73           Specify a configuration file to read additional command-line flags
74           from.  See CONFIGURATION FILE below.
75
76       -h, --help
77           Print this help message and terminate without action.
78
79       -H, --randomize
80           For TCP/IP sockets, randomize the IP addresses returned for the
81           hosts given by the -d switch. This provides for a simple kind of
82           load balancing.  It will try only three times though.
83
84       -l, --log-to-stderr
85           Send log messages to stderr, instead of to the syslog.
86
87       -L learn type, --learntype=type
88           Send message to spamd for learning.  The "learn type" can be either
89           spam, ham or forget.  The exitcode for spamc will be set to 5 if
90           the message was learned, or 6 if it was already learned, under a
91           condition that a --no-safe-fallback option is selected too.
92
93           Note that the "spamd" must run with the "--allow-tell" option for
94           this to work.
95
96       -C report type, --reporttype=type
97           Report or revoke a message to one of the configured collaborative
98           filtering databases.  The "report type" can be either report or
99           revoke.
100
101           Note that the "spamd" must run with the "--allow-tell" option for
102           this to work.
103
104       -p port, --port=port
105           In TCP/IP mode, connect to spamd server listening on given port
106           (default: 783).
107
108       -r, --full-spam
109           Just output the SpamAssassin report text to stdout, if the message
110           is spam.  If the message is ham (non-spam), nothing will be
111           printed.  The first line of the output is the message score and the
112           threshold, in this format:
113
114                   score/threshold
115
116       -R, --full
117           Just output the SpamAssassin report text to stdout, for all
118           messages.  See -r for details of the output format used.
119
120       -s max_size, --max-size=max_size
121           Set the maximum message size which will be sent to spamd -- any
122           bigger than this threshold and the message will be returned
123           unprocessed (default: 500 KB).  If spamc gets handed a message
124           bigger than this, it won't be passed to spamd.  The maximum message
125           size is 256 MB.
126
127           The size is specified in bytes, as a positive integer greater than
128           0.  For example, -s 500000.
129
130       --connect-retries=retries
131           Retry connecting to spamd retries times.  The default is 3 times.
132
133       --retry-sleep=sleep
134           Sleep for sleep seconds between attempts to connect to spamd.  The
135           default is 1 second.
136
137       --filter-retries=retries
138           Retry filtering retries times if the spamd process fails (usually
139           times out).  This differs from --connect-retries in that it times
140           out the transaction after the TCP connection has been established
141           successfully.  The default is 1 time (ie. one attempt and no
142           retries).
143
144       --filter-retry-sleep=sleep
145           Sleep for sleep seconds between failed spamd filtering attempts.
146           The default is 1 second.
147
148       -S, --ssl, --ssl=sslversion
149           If spamc was built with support for SSL, encrypt data to and from
150           the spamd process with SSL; spamd must support SSL as well.
151           sslversion specifies the SSL protocol version to use, either
152           "sslv3", or "tlsv1". The default, is "sslv3".
153
154       -t timeout, --timeout=timeout
155           Set the timeout for spamc-to-spamd communications (default: 600, 0
156           disables).  If spamd takes longer than this many seconds to reply
157           to a message, spamc will abort the connection and treat this as a
158           failure to connect; in other words the message will be returned
159           unprocessed.
160
161       -n timeout, --connect-timeout=timeout
162           Set the timeout for spamc-to-spamd connection establishment
163           (default: 600, 0 disables). If spamc takes longer than this many
164           seconds to establish a connection to spamd, spamc will abort the
165           connection and treat this as a failure to connect; in other words
166           the message will be returned unprocessed.
167
168       -u username, --username=username
169           To have spamd use per-user-config files, run spamc as the user
170           whose config files spamd should load; by default the effective
171           user-ID is sent to spamd.  If you're running spamc as some other
172           user, though, (eg. root, mail, nobody, cyrus, etc.) then you may
173           use this flag to override the default.
174
175       -U socketpath, --socket=path
176           Connect to "spamd" via UNIX domain socket socketpath instead of a
177           TCP/IP connection.
178
179           This option is not supported on Win32 platforms.
180
181       -V, --version
182           Report the version of this "spamc" client.  If built with SSL
183           support, an additional line will be included noting this, like so:
184
185             SpamAssassin Client version 3.0.0-rc4
186               compiled with SSL support (OpenSSL 0.9.7d 17 Mar 2004)
187
188       -x, --no-safe-fallback
189           Disables the 'safe fallback' error-recovery method, which passes
190           through the unaltered message if an error occurs.  Instead, exit
191           with an error code, and let the MTA queue up the mails for a retry
192           later.  See also "EXIT CODES".
193
194           This also disables the TCP fail-over behaviour from -d.
195
196       -X, --unavailable-tempfail
197           When disabling 'safe fallback' with -x, this option will turn
198           EX_UNAVAILABLE errors into EX_TEMPFAIL. This may allow your MTA to
199           defer mails with a temporary SMTP error instead of bouncing them
200           with a permanent SMTP error.  See also "EXIT CODES".
201
202       -y, --tests
203           Just output the names of the tests hit to stdout, on one line,
204           separated by commas.
205
206       -K  Perform a keep-alive check of spamd, instead of a full message
207           check.
208
209       -z  Use gzip compression to compress the mail message sent to "spamd".
210           This is useful for long-distance use of spamc over the internet.
211           Note that this relies on "zlib" being installed on the "spamc"
212           client side, and the "Compress::Zlib" perl module on the server
213           side; an error will be returned otherwise.
214
215       --headers
216           Perform a scan, but instead of allowing any part of the message
217           (header and body) to be rewritten, limit rewriting to only the
218           message headers. This is much more efficient in bandwidth usage,
219           since the response message transmitted back from the spamd server
220           will not include the body.
221
222           Note that this only makes sense if you are using "report_safe 0" in
223           the scanning configuration on the remote end; with "report_safe 1",
224           it is likely to result in corrupt messages.
225

CONFIGURATION FILE

227       The above command-line switches can also be loaded from a configuration
228       file.
229
230       The format of the file is similar to the SpamAssassin rules files;
231       blank lines and lines beginning with "#" are ignored.  Any space-
232       separated words are considered additions to the command line, and are
233       prepended. Newlines are treated as equivalent to spaces. Existing
234       command line switches will override any settings in the configuration
235       file.
236
237       If the -F switch is specified, that file will be used.  Otherwise,
238       "spamc" will attempt to load spamc.conf in "SYSCONFDIR" (default:
239       /etc/mail/spamassassin). If that file doesn't exist, and the -F switch
240       is not specified, no configuration file will be read.
241
242       Example:
243
244           # spamc global configuration file
245
246           # connect to "server.example.com", port 783
247           -d server.example.com
248           -p 783
249
250           # max message size for scanning = 350k
251           -s 350000
252

EXIT CODES

254       By default, spamc will use the 'safe fallback' error recovery method.
255       That means, it will always exit with an exit code of 0, even if an
256       error was encountered.  If any error occurrs, it will simply pass
257       through the unaltered message.
258
259       The -c and -E options modify this; instead, spamc will use an exit code
260       of 1 if the message is determined to be spam.
261
262       If one of the "-x", "-L" or "-C" options are specified, 'safe fallback'
263       will be disabled, and certain error conditions related to communication
264       between spamc and spamd will result in an error code.
265
266       The exit codes used are as follows:
267
268           EX_USAGE        64  command line usage error
269           EX_DATAERR      65  data format error
270           EX_NOINPUT      66  cannot open input
271           EX_NOUSER       67  addressee unknown
272           EX_NOHOST       68  host name unknown
273           EX_UNAVAILABLE  69  service unavailable
274           EX_SOFTWARE     70  internal software error
275           EX_OSERR        71  system error (e.g., can't fork)
276           EX_OSFILE       72  critical OS file missing
277           EX_CANTCREAT    73  can't create (user) output file
278           EX_IOERR        74  input/output error
279           EX_TEMPFAIL     75  temp failure; user is invited to retry
280           EX_PROTOCOL     76  remote error in protocol
281           EX_NOPERM       77  permission denied
282           EX_CONFIG       78  configuration error
283
284           * The EX_TOOBIG error level is never used.  If spamc receives a message
285             that is too big, the exit code will be 0.
286
287           EX_TOOBIG       98  message was too big to process (see --max-size)
288

SEE ALSO

290       spamd(1) spamassassin(1) Mail::SpamAssassin(3)
291

PREREQUISITES

293       "Mail::SpamAssassin"
294

AUTHORS

296       The SpamAssassin(tm) Project <http://spamassassin.apache.org/>
297
299       SpamAssassin is distributed under the Apache License, Version 2.0, as
300       described in the file "LICENSE" included with the distribution.
301
302
303
304perl v5.16.3                      2014-02-07                          SPAMC(1)
Impressum