=head1 NAME

inews - Post an article to a news server

=head1 SYNOPSIS

B<inews> [B<-ADEhHILNOPRSvVWXY>] [B<-acdefFimnorstwx> I<value>]
[B<-p> I<port>] [I<file>]

=head1 DESCRIPTION

B<inews> reads a Usenet news article, perhaps with headers, from I<file> or
standard input if no file is given.  It adds some header fields and performs
some consistency checks.  If the article does not meet those checks, the
article is rejected.  If it passes the checks, B<inews> sends the article to
the news server specified in the I<server> parameter in F<inn.conf>
or overridden by the C<NNTPSERVER> environment variable when running B<inews>.

B<inews> submits articles via POST and is suitable for posting articles that
have not already been injecting into Usenet.  Submitting articles received
from other sources should generally use rnews(1) instead.

By default, if a file named F<.signature> exists in the home directory of
the posting user, it is appended to the post, preceded by a line that
contains only C<-- >.  Signatures are not allowed to be more than four
lines long.

Control messages other than cancel messages are only allowed if B<inews>
is being run by the news user or by a user in the news group and if the
control message is recognized.  If the article contains a Distribution
header field with a distribution that matches one of the bad distribution
patterns in F<inn/options.h> (anything containing a period by default),
the message will be rejected.  The message will also be rejected if
I<checkincludedtext> is true in F<inn.conf>, it contains more quoted text
than original text, and it is over 40 lines long.

If not provided, the Path header field body will be C<not-for-mail>.  If B<-x>
is given, its value will be added to the beginning of the Path header field.
You may for instance want to add a special C<path-identity> value related to
the host running B<inews>, which will appear as C<path-identity!not-for-mail>
in the Path header field.

If posting fails, a copy of the failed post will be saved in a file named
F<dead.article> in the home directory of the user running B<inews>.
B<inews> exits with a non-zero status if posting failed or with a zero
status if posting was successful.

=head1 OPTIONS

Most of the options to B<inews> take a single value and set the
corresponding header field body in the message that is posted.  If the
value is more than one word or contains any shell metacharacters, it
must be quoted to protect it from the shell.  Here are all the options
that set header fields and the corresponding header field body:

    -a  Approved
    -c  Control
    -d  Distribution
    -e  Expires
    -F  References
    -f  From
    -m  Message-ID
    -n  Newsgroups
    -o  Organization
    -r  Reply-To
    -t  Subject
    -w  Followup-To
    -x  Path (prefix)

The B<-x> argument will be added to the beginning of the normal Path header
field body; it will not replace it contrary to what other options do.  This
behaviour is historical, and was first implemented in the B<inews> program
shipped with B News (the original meaning of B<-x> was to say not to forward
the article to a specified site).

=over 4

=item B<-A>, B<-V>, B<-W>

Accepted for compatibility with C News.  These options have no effect.

=item B<-i>, B<-I>, B<-L>, B<-s>, B<-v>, B<-X>

Accepted for compatibility with B<tinews.pl>, shipped with the news reader
tin.  These options have no effect.

=item B<-D>, B<-N>

Perform the consistency checks and add header fields where appropriate,
but then print the article to standard output rather than sending it
to the server.  B<-N> is accepted as a synonym for compatibility with
C News.

=item B<-E>

If the article is empty (that is to say with no body), B<inews> bails out with
an error.  When B<-E> is used, B<inews> will just silently discard the message
and exit.

Note that control messages with no body are not rejected.

=item B<-h>

Normally, this flag should always be given.  It indicates that the article
consists of headers, a blank line, and then the message body.  If it is
omitted, the input is taken to be just the body of the message, and any
desired header fields have to be specified with command-line options as
described above.

=item B<-H>

Print to standard output a help message.

=item B<-O>

By default, an Organization header field will be added if none is present
in the article.  To prevent adding the default (from I<organization>
in F<inn.conf>), use this flag.

=item B<-p> I<port>

Connect to the specified port on the server rather than to the default
(port 119).

=item B<-P>

B<inews> computes a sender address with the username of the user running
B<inews> and the hostname of the news server.  It represents the actual poster
of the article.

By default, a Sender header field will be added with that value if none
is present in the article or if the From header field is not already set to
that value.  Moreover, if a Sender header field is already present, it will be
replaced with that value.

To prevent adding or overwriting the Sender header field, use this flag.

=item B<-R>

Reject all control messages.

=item B<-S>

Do not attempt to append F<~/.signature> to the message, even if it
exists.

=item B<-Y>

By default, B<inews> authenticates to the remote news server only if asked to,
or if the initial NNTP banner corresponds to a state in which postings are not
allowed.  Using this flag leads B<inews> to always authenticate, even if not
asked to.

=back

=head1 EXAMPLES

The following examples show how to post an article with headers and body,
separated by a blank line, written in a file named F<article>.

To post it to the news server set in the I<server> parameter of F<inn.conf>
(which can be C<localhost> if it is the local server), without adding a Sender
header field:

    inews -h -P < article

To force C<news.uu.net> as the server to send the article to:

   NNTPSERVER=news.uu.net inews -h -P < article

For testing purpose, to see the article that will be posted, without actually
sending it but only writing it to the standard output:

    inews -h -P -D < article

If F<article> only contains a message without headers, you may use:

    inews -t 'Hello' -n misc.test -f 'Bob <bob@uu.net>' -P < article

=head1 NOTES

If the NNTP server requests authentication, B<inews> will try to read
F<passwd.nntp> to get the username and password to use and will therefore
need read access to that file.  This is typically done by making that file
group-readable and adding all users who should be able to use B<inews> to
post to that server to the appropriate group.

B<inews> used to do even more than it does now, and all of the remaining
checks that are not dependent on the user running B<inews> should probably
be removed in favor of letting the news server handle them.

Since INN's B<inews> uses F<inn.conf> and some other corners of an INN
installation, it's not very appropriate as a general standalone B<inews>
program for general use on a system that's not running a news server.  Other,
more suitable versions of B<inews> are available as part of various Unix
news clients or by themselves.  We try to keep compatibility with the flags
other implementations use (like C News, inews-xt, and the still actively
maintained B<tinews.pl> shipped with the news reader tin or downloadable from
L<http://bzr.tin.org/tools/tinews.pl> for a standalone use).

=head1 HISTORY

Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.  Rewritten in
POD by Russ Allbery <eagle@eyrie.org>.

=head1 SEE ALSO

inn.conf(5), passwd.nntp(5), rnews(1).

=cut
