chip@ateng.com (Chip Salzenberg) (11/16/89)
According to louis@asterix.drev.dnd.ca (Louis Demers): >I would like to have messages received (by ordinary email) >from a mailing list posted to a local newsgroup. Here's a solution based on Deliver 2.0, which is a general-purpose mail delivery program. If you don't have it, look in the comp.sources.unix archives on uunet.uu.net or elsewhere. Basic chain of events: 1. Somehow arrange to let Deliver handle incoming mail from the mailing list. If your mailer of choice doesn't know how to do that, we can solve that problem in another article. :-) Sendmail or Smail 3 should have no problem, and Smail 2.5 just needs a #define. 2. Take the "del.news" script, packaged below, and install it as "/usr/local/lib/del.news". 3. Install code like this in the post-user delivery file, which is a shell script that Deliver runs before delivering mail: for user do case "$user" in local-list-address) /usr/local/lib/del.news local local.group.name echo DROP ;; *) echo "$user" ;; esac done 4. Have fun. :-) The del.news script does a _basic_ (and I do mean _basic_) job of gatewaying mail to news. I know it works, because we use it at ATE for a set of local newsgroups. Shar and enjoy. #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: del.news # Wrapped by chip@ateng on Wed Nov 15 19:21:01 1989 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'del.news' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'del.news'\" else echo shar: Extracting \"'del.news'\" \(612 characters\) sed "s/^X//" >'del.news' <<'END_OF_FILE' X: del.news X# Shell script run by post-user delivery file. X Xif [ $# -ne 2 ] Xthen X echo >&2 "usage: $0 distribution newsgroups" X exit 1 Xfi X XDIST="$1" XGROUPS="$2" X X( X echo "Newsgroups: $GROUPS" X [ "$DIST" = "world" ] || echo "Distribution: $DIST" X X u=`header -f From $HEADER` X if [ "$u" ] X then X here=`cat /usr/lib/news/mailname 2>/dev/null` X [ "$here" ] || here=`uuname -l`.UUCP X X case $u in X *@*) echo "From: $u" ;; X esac X fi X X header -n -f Subject $HEADER X X echo "" X X sed '${/^$/d;}' $BODY X) | X( X LOGNAME=$SENDER X export LOGNAME X X /usr/lib/news/inews -h X) X Xecho DROP END_OF_FILE if test 612 -ne `wc -c <'del.news'`; then echo shar: \"'del.news'\" unpacked with wrong size! fi chmod +x 'del.news' # end of 'del.news' fi echo shar: End of shell archive. exit 0 -- You may redistribute this article only to those who may freely do likewise. Chip Salzenberg at A T Engineering; <chip@ateng.com> or <uunet!ateng!chip> "Did I ever tell you the Jim Gladding story about the binoculars?"