1SPAMC(1) User Contributed Perl Documentation SPAMC(1)
2
3
4
6 spamc - client for spamd
7
9 spamc [options] < message
10
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
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, one of
152 "sslv2", "sslv3", "tlsv1", or "sslv23". The default, "sslv23",
153 causes spamc to use a SSLv2 hello handshake then negotiate use of
154 SSLv3 or TLSv1 protocol if the spamd server can accept it.
155
156 -t timeout, --timeout=timeout
157 Set the timeout for spamc-to-spamd communications (default: 600, 0
158 disables). If spamd takes longer than this many seconds to reply
159 to a message, spamc will abort the connection and treat this as a
160 failure to connect; in other words the message will be returned
161 unprocessed.
162
163 -n timeout, --connect-timeout=timeout
164 Set the timeout for spamc-to-spamd connection establishment
165 (default: 600, 0 disables). If spamc takes longer than this many
166 seconds to establish a connection to spamd, spamc will abort the
167 connection and treat this as a failure to connect; in other words
168 the message will be returned unprocessed.
169
170 -u username, --username=username
171 To have spamd use per-user-config files, run spamc as the user
172 whose config files spamd should load; by default the effective
173 user-ID is sent to spamd. If you're running spamc as some other
174 user, though, (eg. root, mail, nobody, cyrus, etc.) then you may
175 use this flag to override the default.
176
177 -U socketpath, --socket=path
178 Connect to "spamd" via UNIX domain socket socketpath instead of a
179 TCP/IP connection.
180
181 This option is not supported on Win32 platforms.
182
183 -V, --version
184 Report the version of this "spamc" client. If built with SSL
185 support, an additional line will be included noting this, like so:
186
187 SpamAssassin Client version 3.0.0-rc4
188 compiled with SSL support (OpenSSL 0.9.7d 17 Mar 2004)
189
190 -x, --no-safe-fallback
191 Disables the 'safe fallback' error-recovery method, which passes
192 through the unaltered message if an error occurs. Instead, exit
193 with an error code, and let the MTA queue up the mails for a retry
194 later. See also "EXIT CODES".
195
196 This also disables the TCP fail-over behaviour from -d.
197
198 -y, --tests
199 Just output the names of the tests hit to stdout, on one line,
200 separated by commas.
201
202 -K Perform a keep-alive check of spamd, instead of a full message
203 check.
204
205 -z Use gzip compression to compress the mail message sent to "spamd".
206 This is useful for long-distance use of spamc over the internet.
207 Note that this relies on "zlib" being installed on the "spamc"
208 client side, and the "Compress::Zlib" perl module on the server
209 side; an error will be returned otherwise.
210
211 --headers
212 Perform a scan, but instead of allowing any part of the message
213 (header and body) to be rewritten, limit rewriting to only the
214 message headers. This is much more efficient in bandwidth usage,
215 since the response message transmitted back from the spamd server
216 will not include the body.
217
218 Note that this only makes sense if you are using "report_safe 0" in
219 the scanning configuration on the remote end; with "report_safe 1",
220 it is likely to result in corrupt messages.
221
223 The above command-line switches can also be loaded from a configuration
224 file.
225
226 The format of the file is similar to the SpamAssassin rules files;
227 blank lines and lines beginning with "#" are ignored. Any space-
228 separated words are considered additions to the command line, and are
229 prepended. Newlines are treated as equivalent to spaces. Existing
230 command line switches will override any settings in the configuration
231 file.
232
233 If the -F switch is specified, that file will be used. Otherwise,
234 "spamc" will attempt to load spamc.conf in "SYSCONFDIR" (default:
235 /etc/mail/spamassassin). If that file doesn't exist, and the -F switch
236 is not specified, no configuration file will be read.
237
238 Example:
239
240 # spamc global configuration file
241
242 # connect to "server.example.com", port 783
243 -d server.example.com
244 -p 783
245
246 # max message size for scanning = 350k
247 -s 350000
248
250 By default, spamc will use the 'safe fallback' error recovery method.
251 That means, it will always exit with an exit code if 0, even if an
252 error was encountered. If any error occurrs, it will simply pass
253 through the unaltered message.
254
255 The -c and -E options modify this; instead, spamc will use an exit code
256 of 1 if the message is determined to be spam.
257
258 If one of the "-x", "-L" or "-C" options are specified, 'safe fallback'
259 will be disabled, and certain error conditions related to communication
260 between spamc and spamd will result in an error code. The exit codes
261 used are as follows:
262
263 EX_USAGE 64 command line usage error
264 EX_DATAERR 65 data format error
265 EX_NOINPUT 66 cannot open input
266 EX_NOUSER 67 addressee unknown
267 EX_NOHOST 68 host name unknown
268 EX_UNAVAILABLE 69 service unavailable
269 EX_SOFTWARE 70 internal software error
270 EX_OSERR 71 system error (e.g., can't fork)
271 EX_OSFILE 72 critical OS file missing
272 EX_CANTCREAT 73 can't create (user) output file
273 EX_IOERR 74 input/output error
274 EX_TEMPFAIL 75 temp failure; user is invited to retry
275 EX_PROTOCOL 76 remote error in protocol
276 EX_NOPERM 77 permission denied
277 EX_CONFIG 78 configuration error
278 EX_TOOBIG 98 message was too big to process (see --max-size)
279
281 spamd(1) spamassassin(1) Mail::SpamAssassin(3)
282
284 "Mail::SpamAssassin"
285
287 The SpamAssassin(tm) Project <http://spamassassin.apache.org/>
288
290 SpamAssassin is distributed under the Apache License, Version 2.0, as
291 described in the file "LICENSE" included with the distribution.
292
293
294
295perl v5.12.4 2011-06-06 SPAMC(1)