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 spamas‐
17 sassin program.
18
19 See the README file in the spamd directory of the SpamAssassin distri‐
20 bution 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 Spa‐
28 mAssassin 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 be‐
42 haviour 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 incom‐
52 patible with -x; if that switch is used, fail-over will not occur.
53
54 -e command [args], --pipe-to command [args]
55 Instead of writing to stdout, pipe the output to command's standard
56 input. Note that there is a very slight chance mail will be lost
57 here, because if the fork-and-exec fails there's no place to put
58 the mail message.
59
60 Note that this must be the LAST command line option, as everything
61 after the -e is taken as arguments to the command (it's like rxvt
62 or xterm).
63
64 This option is not supported on Win32 platforms.
65
66 -E, --exitcode
67 Filter according to the other options, but set the process exitcode
68 to 1 if message is spam, 0 if not spam or processing failure
69 occurs.
70
71 -F /path/to/file, --config=path
72 Specify a configuration file to read additional command-line flags
73 from. See CONFIGURATION FILE below.
74
75 -h, --help
76 Print this help message and terminate without action.
77
78 -H, --randomize
79 For TCP/IP sockets, randomize the IP addresses returned for the
80 hosts given by the -d switch. This provides for a simple kind of
81 load balancing. It will try only three times though.
82
83 -l, --log-to-stderr
84 Send log messages to stderr, instead of to the syslog.
85
86 -L learn type, --learntype=type
87 Send message to spamd for learning. The "learn type" can be either
88 spam, ham or forget. The exitcode for spamc will be set to 5 if
89 the message was learned, or 6 if it was already learned.
90
91 Note that the "spamd" must run with the "--allow-tell" option for
92 this to work.
93
94 -C report type, --reporttype=type
95 Report or revoke a message to one of the configured collaborative
96 filtering databases. The "report type" can be either report or
97 revoke.
98
99 Note that the "spamd" must run with the "--allow-tell" option for
100 this to work.
101
102 -p port, --port=port
103 In TCP/IP mode, connect to spamd server listening on given port
104 (default: 783).
105
106 -r, --full-spam
107 Just output the SpamAssassin report text to stdout, if the message
108 is spam. If the message is ham (non-spam), nothing will be
109 printed. The first line of the output is the message score and the
110 threshold, in this format:
111
112 score/threshold
113
114 -R, --full
115 Just output the SpamAssassin report text to stdout, for all mes‐
116 sages. See -r for details of the output format used.
117
118 -s max_size, --max-size=max_size
119 Set the maximum message size which will be sent to spamd -- any
120 bigger than this threshold and the message will be returned unpro‐
121 cessed (default: 500 KB). If spamc gets handed a message bigger
122 than this, it won't be passed to spamd. The maximum message size
123 is 256 MB.
124
125 The size is specified in bytes, as a positive integer greater than
126 0. For example, -s 500000.
127
128 --connect-retries=retries
129 Retry connecting to spamd retries times. The default is 3 times.
130
131 --retry-sleep=sleep
132 Sleep for sleep seconds between attempts to connect to spamd. The
133 default is 1 second.
134
135 -S, --ssl, --ssl=sslversion
136 If spamc was built with support for SSL, encrypt data to and from
137 the spamd process with SSL; spamd must support SSL as well.
138 sslversion specifies the SSL protocol version to use, one of
139 "sslv2", "sslv3", "tlsv1", or "sslv23". The default, "sslv23",
140 causes spamc to use a SSLv2 hello handshake then negotiate use of
141 SSLv3 or TLSv1 protocol if the spamd server can accept it.
142
143 -t timeout, --timeout=timeout
144 Set the timeout for spamc-to-spamd communications (default: 600, 0
145 disables). If spamd takes longer than this many seconds to reply
146 to a message, spamc will abort the connection and treat this as a
147 failure to connect; in other words the message will be returned
148 unprocessed.
149
150 -u username, --username=username
151 To have spamd use per-user-config files, run spamc as the user
152 whose config files spamd should load; by default the effective
153 user-ID is sent to spamd. If you're running spamc as some other
154 user, though, (eg. root, mail, nobody, cyrus, etc.) then you may
155 use this flag to override the default.
156
157 -U socketpath, --socket=path
158 Connect to "spamd" via UNIX domain socket socketpath instead of a
159 TCP/IP connection.
160
161 This option is not supported on Win32 platforms.
162
163 -V, --version
164 Report the version of this "spamc" client. If built with SSL sup‐
165 port, an additional line will be included noting this, like so:
166
167 SpamAssassin Client version 3.0.0-rc4
168 compiled with SSL support (OpenSSL 0.9.7d 17 Mar 2004)
169
170 -x, --no-safe-fallback
171 Disables the 'safe fallback' error-recovery method, which passes
172 through the unaltered message if an error occurs. Instead, exit
173 with an error code, and let the MTA queue up the mails for a retry
174 later. See also "EXIT CODES".
175
176 This also disables the TCP fail-over behaviour from -d.
177
178 -y, --tests
179 Just output the names of the tests hit to stdout, on one line, sep‐
180 arated by commas.
181
182 -K Perform a keep-alive check of spamd, instead of a full message
183 check.
184
185 -z Use gzip compression to compress the mail message sent to "spamd".
186 This is useful for long-distance use of spamc over the internet.
187 Note that this relies on "zlib" being installed on the "spamc"
188 client side, and the "Compress::Zlib" perl module on the server
189 side; an error will be returned otherwise.
190
191 --headers
192 Perform a scan, but instead of allowing any part of the message
193 (header and body) to be rewritten, limit rewriting to only the mes‐
194 sage headers. This is much more efficient in bandwidth usage, since
195 the response message transmitted back from the spamd server will
196 not include the body.
197
198 Note that this only makes sense if you are using "report_safe 0" in
199 the scanning configuration on the remote end; with "report_safe 1",
200 it is likely to result in corrupt messages.
201
203 The above command-line switches can also be loaded from a configuration
204 file.
205
206 The format of the file is similar to the SpamAssassin rules files;
207 blank lines and lines beginning with "#" are ignored. Any space-sepa‐
208 rated words are considered additions to the command line, and are
209 prepended. Newlines are treated as equivalent to spaces. Existing com‐
210 mand line switches will override any settings in the configuration
211 file.
212
213 If the -F switch is specified, that file will be used. Otherwise,
214 "spamc" will attempt to load spamc.conf in "SYSCONFDIR" (default:
215 /etc/mail/spamassassin). If that file doesn't exist, and the -F switch
216 is not specified, no configuration file will be read.
217
218 Example:
219
220 # spamc global configuration file
221
222 # connect to "server.example.com", port 783
223 -d server.example.com
224 -p 783
225
226 # max message size for scanning = 350k
227 -s 350000
228
230 By default, spamc will use the 'safe fallback' error recovery method.
231 That means, it will always exit with an exit code if 0, even if an
232 error was encountered. If any error occurrs, it will simply pass
233 through the unaltered message.
234
235 The -c and -E options modify this; instead, spamc will use an exit code
236 of 1 if the message is determined to be spam.
237
238 If the "-x" option is specified, 'safe fallback' will be disabled, and
239 certain error conditions related to communication between spamc and
240 spamd will result in an error code. The exit codes used are as fol‐
241 lows:
242
243 EX_USAGE 64 command line usage error
244 EX_DATAERR 65 data format error
245 EX_NOINPUT 66 cannot open input
246 EX_NOUSER 67 addressee unknown
247 EX_NOHOST 68 host name unknown
248 EX_UNAVAILABLE 69 service unavailable
249 EX_SOFTWARE 70 internal software error
250 EX_OSERR 71 system error (e.g., can't fork)
251 EX_OSFILE 72 critical OS file missing
252 EX_CANTCREAT 73 can't create (user) output file
253 EX_IOERR 74 input/output error
254 EX_TEMPFAIL 75 temp failure; user is invited to retry
255 EX_PROTOCOL 76 remote error in protocol
256 EX_NOPERM 77 permission denied
257 EX_CONFIG 78 configuration error
258
260 spamd(1) spamassassin(1) Mail::SpamAssassin(3)
261
263 "Mail::SpamAssassin"
264
266 The SpamAssassin(tm) Project <http://spamassassin.apache.org/>
267
269 SpamAssassin is distributed under the Apache License, Version 2.0, as
270 described in the file "LICENSE" included with the distribution.
271
272
273
274perl v5.8.8 2008-01-29 SPAMC(1)