Path: utzoo!utgpu!watserv1!watmath!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!wuarchive!udel!rochester!kodak!ispd-newsserver!ism.isc.com!b1.ism.isc.com!nealpo From: nealpo@b1.ism.isc.com (Neal Pollack) Newsgroups: news.software.b Subject: Re: How do I use recenews? Summary: Use this instead Message-ID: <1991Mar01.005521.6103@ism.isc.com> Date: 1 Mar 91 00:55:21 GMT References: <1991Feb18.214728.11667@vitro.com> <1991Feb19.215942.23527@zoo.toronto.edu> <1991Feb27.200859.22746@casbah.acns.nwu.edu> <1991Feb28.133534.17116@vitro.com> Sender: usenet@ism.isc.com (Ism Usenet News) Reply-To: nealpo@b1.ism.isc.com (Neal Pollack) Organization: Interactive Systems Corp., Santa Monica, CA Lines: 127 > >This is the sort of thing I was looking for when I originally asked this >question. I have never used B news, but will look into the source from >the archive. What I do is mail news to people who don't have News >software and I want to give them a header template to fill in and mail >some alias to post it. I tried piping something like that to inews -h >but it didn't work. Recenews uses the b7encoding and I don't get mail >from them that way. I hope we can come up with something here. >-- > Steve Brailsford (fsb@vitro.com) _____ > Usenet: uupsi!vitro!fsb \/itro Corporation There is the following shell script that works fine for taking a mail note from a mail alias, and posting it to a newsgroup. I do not remember if we had to "adjust" inews for any reason. You may want to adjust this script to your own needs. #!/bin/sh # call this ~/newsbin/input/recvnews or whatever # usenet newsgroup1 ... newsgroupn # # sendmail-compatible usenet transport agent. # Jean-Francois Lamy (lamy@ai.toronto.edu), 89-06-02 # based on code by Rayan Zachariassen. # # The arguments are the newsgroups to which the article should be posted. A # complete message, including To:, From: and From_ line expected on stdin. # This assumes of course that the necessary magic has been done so that # the mailer recognizes newsgroup name and decides to use the usenet transport # agent on them. # # Notes: # # - this script should ultimately result in the invocation of a real # "inews" that deals with moderated newsgroups and invokes relaynews. # This version calls nntp, which results in calling a real inews on # the news server. # # - The news program invoked by this script should trust From: lines # (otherwise workstation name hiding, full-name id generation and # all other smarts done by the mailer will be lost) # # - newsgroup "postnews" is ignored, and is used so one can mail # to a postnews alias a message with a Newsgroups: header, with # postnews aliased to postnews@usenet, where usenet is a fake host # handled by this transport agent. # # - Normally a From_ line of site!user and a From: line of user@site # should be produced. If your sendmail cannot be coerced into rewriting # envelope and headers differently you will need to kludge it here. # # # ZMailer notes: # # - The default router.cf does the appropriate things, provided that # scheduler.cf contains: # usenet/* 1m 10 0 0 root daemon sm -c $channel usenet # sm.cf contains: # usenet m /local/lib/mail/bin/usenet usenet $u # (adjust this to reflect the actual location of the installed copy of # this script, of course) # hosts.transport contains a line with: # usenet usenet! # and that the aliases file contains aliases of the form # gradnews: gradnews@usenet # for all newsgroup names that don't have embedded "."). LOGNAME=usenet USER=usenet NAME="YourSite Usenet Mailgate" export LOGNAME USER NAME # make sure this does not end up calling this script again! inews=/usr/local/lib/newsbin/inject/inews orgflag=1 org="`cat /usr/lib/news/organi?ation`" [ "$org" ] || orgflag=1 # do not print empty Organization: header from=/tmp/from$$ for i in $@ do groups="${groups+$groups,}$i" done awk "BEGIN { subject = 0; body = 0; skipping = 0 ; newsgroups = 0; distribution = 0; organization = $orgflag; } body == 1 { print; next } /^$|^[ ][ \\t]*$/ { if (!body) { np = split(path,parts,\"!\"); if (!organization && np == 1) print \"Organization: $org\"; if (!newsgroups) print \"Newsgroups: $groups\"; if (!subject) print \"Subject: (none)\"; } print; body = 1; next } /^To:|^X-To:|^Cc:|^Apparently-To:/ { skipping=1 ; next } /^Received:/ { skipping = 1; next } /^Newsgroups:/ { newsgroups = 1; skipping = 0; printf(\"%s\",\$0); if (\"$groups\" != \"\" && \"$groups\" != \"postnews\") printf(\",%s\\n\",\"$groups\"); else printf(\"\\n\"); next } /^Organi[sz]ation:/ { organization = 1; skipping = 0; print; next } /^Distribution:/ { distribution = 1; skipping = 0; print; next } /^Subject:/ { subject = 1; skipping = 0; print; next } /^From:/ { print \$2 > from ; path = \$2 ; skipping = 0; print; next } /^From |^Return-Path:/ { print \$2 > from ; path = \$2 ; skipping = 1; next } /^[ ]/ { if (skipping) next } /^[A-Za-z-]*:[ \\t]*$/ { if (!body) next } { print } " from="$from" - >/tmp/usenet.$$-1 if [ ! -s $from ]; then echo "nobody@nowhere.no.domain" > $from fi (echo "Path: `sed 1q $from`" ; cat /tmp/usenet.$$-1 ) > /tmp/usenet.$$-2 $inews -W < /tmp/usenet.$$-2 2>>/tmp/errs rm $from /tmp/usenet.$$-* exit 0