spamc.pod   [plain text]



=head1 NAME

spamc - client for spamd

=head1 SYNOPSIS

=over

=item spamc [options] < message

=back

=head1 OPTIONS

=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 is
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.

=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 number of hits and the threshold,
in this format:

	hits/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<-y>

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

=item B<-d> I<host>

Connect to spamd server on given host.  If I<host> resolves to multiple
addresses, then spamc will fail-over to the other addresses, if the first one
cannot be connected to.

=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>).

=item B<-f>

Cause spamc to safe-failover if it can't connect to spamd -- what this means
is that in case spamc fails to connect to spamd, it will not return with an
exitcode set, it will instead dump the original message to stdout, allowing
the message to be delivered, albeit unscanned for spam.  Without this flag,
connection failures to spamd will cause message delivery failures.

Even with this flag set however, if spamc connects successfully, and then
encounters an error at a later stage of communication, it will still return
an exitcode.

This now defaults to B<on>.  This flag is accepted though for
backwards-compatibility.  B<-x> can be used to tell spamc to use an
exit-code which will cause the message to be re-queued by the MTA instead.

=item B<-h>

Print this help message and terminate without action.

=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<-p> I<port>

Connect to spamd server listening on given port.

=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.  Note that the
default size is 250k, so if spamc gets handed a message bigger than this, it
won't be passed to spamd.  The size is specified in bytes, and if you send it a
negative number, things are quite likely to break very hard.

=item B<-t> I<timeout>

Set the timeout for spamc-to-spamd communications.  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<-x>

Don't use 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.  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

=item B<-U> I<socketpath>

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

=item B<-H>

For TCP/IP sockets, randomize the IP addresses returned from a DNS name
lookup (when more than one IP is returned). This provides for a kind of
hostname-base load balancing.

=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 SEE ALSO

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

=head1 AUTHOR

Craig R Hughes E<lt>craig@hughes-family.orgE<gt>

=head1 PREREQUISITES

C<Mail::SpamAssassin>

=cut