NAME
news2mail − feed a Usenet news article to mail
SYNOPSIS
news2mail [ −Evar=value ] [ −. ] listname listaddr listadmin host [ article ]
DESCRIPTION
News2mail reads a news article edits the headers to make it look like an RFC822 mail message. It feeds the results to sendmail(8), MMDF(8), or a shell script. If the ’’−.’’ flag is used, then the results are sent to standard output, for debugging.
The article is taken from the file specified on the command line, or read from standard input if not specified.
The ’’−E’’ flag can be used to set environment variables for the delivery program that is invoked. They should be of the form ’’name=value’’ as in ’’−E mailer=/usr/lib/pp/cmds/submit’’.
News2mail swallows control messages, removes all but the last three entries from the ’’References’’ header, and merges the ’’From’’ and ’’Path’’ headers to build a single ’’From’’ header for the mail message (see below). The ’’Date,’’ ’’Subject,’’ ’’Reply−To,’’ ’’Message−ID,’’ ’’Organization,’’ ’’Control,’’ ’’MIME−Version,’’ ’’Content-Type,’’ and ’’Content-Transfer-Encoding’’ headers are passed through unchanged. Any other headers in the original input are removed.
To ’’To,’’ and ’’Sender’’ headers and the SMTP destination envelope are set according to the parameters specified on the command line. The ’’To’’ header is set to be listname, with @host appended if there is no atsign in listname. This should contain the name of the mailing list. The mail is actually sent to listaddr by specifying it as the recipient in the mailer command line. (If listaddr does not have an atsign, then listaddr@host is used.) By treating the ’’To’’ header and the destination envelope separately, other members of the mailing list can properly reply to the messages that pass through news2mail. In addition, listaddr can be an address that sends to everyone on the list except the gateway. This is an optimization, however, because inews(8) will reject any Message-ID that it has already seen.
The ’’Sender’’ header is set to be listadmin, with @host appended if there is no atsign in listadmin. These values should correspond to the maintainer of the mailing list. Some mailers will also automatically fill in the ’’Return-Path’’ header with this value.
The goal of the header manipulations is to send the news article to all recipient of the mailing list, but with the headers set so that delivery errors are sent to the list maintainer for disposition.
Mail2news tries to shrink the ’’Path’’ header by taking note of neighboring UUCP hosts and scanning for other Internet hosts that it can short−circuit to. Uuname(1) is used to check for UUCP neighbors; the file uucp−2−inet is read to map UUCP names to Internet domain names. For efficiency, mail2news stores uuname’s output in a private file, and will only call uuname if the file is older than the UUCP L.sys(5) file.
In order to have sendmail believe that the headers it has created are valid, news2mail must be able to setuid(2) to one of sendmail’s trusted users.
EXAMPLE
Suppose the following article arrives comp.sources.unix:
Path: news.bbn.com!uunet!rsalz
From: rsalz [AT] uunet.NET (Rich Salz)
Newsgroups: comp.sources.unix
Subject: v10INF1: Introduction to comp.sources.unix
Message−ID: <830 [AT] uunet.NET>
Date: 10 Aug 87 21:57:17 GMT
Expires: 10 Nov 87 22:17:17 GMT
Organization: UUNET Communications Services, Arlington, VA
Lines: 189
Approved: rsalz [AT] uunet.NET
This is the
first of two introductory articles about comp.sources.unix.
...
Also, assume the following line is in your news sys file (see news(5)):
gateway:world,comp.sources.unix::\
news2mail unix−sources rsalz
unix−sources−request bbn.com
The news2mail program would generate the following article and feed it to sendmail:
Received: from USENET by bbn.com with netnews
for rsalz [AT] bbn.com (unix−sources [AT] bbn.com); | ||
contact usenet [AT] bbn.com if you have questions. |
To: unix−sources [AT] bbn.com
Date: 10 Aug 87 21:57:17 GMT
From: rsalz [AT] uunet.net (Rich Salz)
Sender: unix−sources−request [AT] bbn.com
Subject: v10INF1: Introduction to comp.sources.unix
Message−ID: <830 [AT] uunet.NET>
Organization: UUNET Communications Services, Arlington,
VA
This is the
first of two introductory articles about comp.sources.unix.
...
DIAGNOSTICS
Most return values from I/O routines are checked; if anything goes wrong, a diagnostic message is sent to standard error.
SEE ALSO
AUTHOR
Rich $alz
<rsalz [AT] bbn.com>, after a set of scripts and a
excellent manpage by
Erik E. Fair <fair [AT] apple.com>.
Piete Brooks <pb [AT] computer-lab.uk> helped
write the option-handling.