File: spamc.pod

package info (click to toggle)
spamassassin 3.1.7-2
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 5,376 kB
  • ctags: 2,123
  • sloc: perl: 39,706; ansic: 3,133; sh: 1,344; sql: 170; makefile: 168
file content (275 lines) | stat: -rw-r--r-- 8,939 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
=cut

<@LICENSE>
Copyright 2004 Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</@LICENSE>

=head1 NAME

spamc - client for spamd

=head1 SYNOPSIS

=over

=item spamc [options] < message

=back

=head1 DESCRIPTION

Spamc is the client half of the spamc/spamd pair.  It should be used in place
of C<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 F<README> file in the F<spamd> directory of the SpamAssassin
distribution for more details.

=head1 OPTIONS

All options detailed below can be passed as command line arguments, or be
contained in a configuration file, as described in the B<CONFIGURATION FILE>
section below.

=over

=item B<-B>

Assume input is a single BSMTP-formatted message. In other words, spamc will
pull out everything between the DATA line and the lone-dot line to feed to
spamd, and will place the spamd output back in the same envelope (thus, any
SIZE extension in your BSMTP file will cause many problems).

=item B<-c>

Just check if the message is spam or not.  Set process exitcode to 1 if
message is spam, 0 if not spam or processing failure occurs.  Will print
score/threshold to stdout (as ints) or 0/0 if there was an error.
Combining B<-c> and B<-E> is a no-op, since B<-c> implies the behaviour
of B<-E>.

=item B<-d> I<host[,host2]>

In TCP/IP mode, connect to spamd server on given host (default: localhost).
Several hosts can be specified if separated by commas.

If I<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.

=item B<-e> I<command> I<[args]>

Instead of writing to stdout, pipe the output to I<command>'s standard input.
Note that there is a very slight chance mail will be lost here, because if the
fork-and-exec fails there's no place to put the mail message.

Note that this must be the LAST command line option, as everything after the
B<-e> is taken as arguments to the command (it's like I<rxvt> or I<xterm>).

This option is not supported on Win32 platforms.

=item B<-E>

Filter according to the other options, but set the process exitcode to 1 if
message is spam, 0 if not spam or processing failure occurs.

=item B<-F> I</path/to/file>

Specify a configuration file to read additional command-line flags from.
See B<CONFIGURATION FILE> below.

=item B<-h>

Print this help message and terminate without action.

=item B<-H>

For TCP/IP sockets, randomize the IP addresses returned for the hosts given
by the B<-d> switch. This provides for a simple kind of load balancing.  It
will try only three times though.

=item B<-l>

Send log messages to stderr, instead of to the syslog.

=item B<-L> I<learn type>

Send message to spamd for learning.  The C<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 C<spamd> must run with the C<--allow-tell> option for
this to work.

=item B<-C> I<report type>

Report or revoke a message to one of the configured collaborative filtering
databases.  The C<report type> can be either report or revoke.

Note that the C<spamd> must run with the C<--allow-tell> option for
this to work.

=item B<-p> I<port>

In TCP/IP mode, connect to spamd server listening on given port 
(default: 783).

=item B<-r>

Just output the SpamAssassin report text to stdout, if the message is
spam.  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
this format:

	score/threshold

=item B<-R>

Just output the SpamAssassin report text to stdout, for all messages.
See B<-r> for details of the output format used.

=item B<-s> I<max_size>

Set the maximum message size which will be sent to spamd -- any bigger than
this threshold and the message will be returned unprocessed (default: 250 KB).
If spamc gets handed a message bigger than this, it won't be passed to spamd.

The size is specified in bytes, as a positive integer greater than 0.
For example, B<-s 250000>.

=item B<-S>

If spamc was built with support for SSL, encrypt data to and from the
spamd process with SSL; spamd must support SSL as well.

=item B<-t> I<timeout>

Set the timeout for spamc-to-spamd communications (default: 600, 0 disables).
If spamd takes longer than this many seconds to reply to a message, spamc 
will abort the connection and treat this as a failure to connect; in other 
words the message will be returned unprocessed.  

=item B<-u> I<username>

This argument has been semi-obsoleted.  To have spamd use per-user-config
files, run spamc as the user whose config files spamd should load.  If you're
running spamc as some other user, though, (eg. root, mail, nobody, cyrus, etc.)
then you can still use this flag.

=item B<-U> I<socketpath>

Connect to C<spamd> via UNIX domain socket I<socketpath> instead of a
TCP/IP connection.

This option is not supported on Win32 platforms.

=item B<-V>

Report the version of this C<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)

=item B<-x>

Disables the 'safe fallback' error-recovery method, 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 L<"EXIT CODES">.

=item B<-y>

Just output the names of the tests hit to stdout, on one line, separated
by commas.

=back

=head1 CONFIGURATION FILE

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 C<#> 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 B<-F> switch is specified, that file will be used.  Otherwise,
C<spamc> will attempt to load spamc.conf in C<SYSCONFDIR> (default:
/etc/mail/spamassassin). If that file doesn't exist, and the B<-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

=head1 EXIT CODES

By default, spamc will use the 'safe fallback' error recovery method.  That 
means, it will always exit with an exit code if C<0>, even if an error was 
encountered.  If any error occurrs, it will simply pass through the unaltered 
message.

The B<-c> and B<-E> options modify this; instead, spamc will use an exit code
of C<1> if the message is determined to be spam.

If the C<-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

=head1 SEE ALSO

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

=head1 PREREQUISITES

C<Mail::SpamAssassin>

=head1 AUTHORS

The SpamAssassin(tm) Project <http://spamassassin.apache.org/>

=head1 COPYRIGHT

SpamAssassin is distributed under the Apache License, Version 2.0, as
described in the file C<LICENSE> included with the distribution.