So for example if the email address to which email from the list is to
be sent (the subscribed mail address) is
# The site subscription address for blah-blah@some.mailing.list
site_list: "| /usr/local/scripts/mail2news.pl local.site.group"
______________________________________________________________________
Make an entry for each mailing list that is to be gated to oyur local
news server and and then run newaliases.
6. Setting up the news groups and news server (innd)
Using ctlinnd, create the newsgroups on your news server. Remember,
these are to be local news groups, so start them with a distinctive
name so you can filter them out from your news distributions (in your
newsfeeds file).
You also need to tell innd that the group is moderated (by using
ctlinnd). Remember, innd is very sensitive to file ownership and
permissions, so you need to interct at this level with innd as the
news user. Indicating a moderated group is done by specifying m to the
newgroup command.
______________________________________________________________________
ctlinnd newgroup m
______________________________________________________________________
The m tells innd that the group is moderated.
Edit your newsfeeds file to make sure that these local groups are not
distributed (unless you specificaly wish this to occur).
For example, if your mailing list is called local.site.group, then you
would probably want to add !local* to the second field of your up (and
possibly your down) stream news sites in your newsfeeds file.
Now, in order to ensure that user messages are sent to the list
automatically by innd, edit /etc/news/moderators to include a line
declaring the mailing list email address as the moderator.
______________________________________________________________________
some.site.list:list@mail.list.site
______________________________________________________________________
7. Subscribing the mail2 news alias to the mailing list
You now need to subscribe the mail alias to the mailing list. Check
with the mailing list information as to how to subscribe. Some mailing
lists allow you to subscribe an email address that is different from
the address from which the subscription comes (they check back to the
address to be subscribed for confirmation before actually subscribing
that address).
Other mailing lists do not permit this. So you may need to 'forge' a
subscription request. There are many ways of doing this. One of the
easiest is to use Netscape mail set up (temporarily) with the address
to which the mailing list is to send the mail.
After subscribing, you should see a 'welcome' message of some kind
from the list server in the news group - in which case all is well and
you can now test the other direction by posting a news message to your
new list.
The message should *NOT* appear in the newsgroup at once. It should
get sent out by mail and then received back and posted to the news
group.
If this works, you have succeed in getting the list gated to news.
8. If it doesn't work...
If things don't work, you need to track through the path the messages
are taking to see exactly where things are breaking down. Useful tools
here are the mail and news logs.
Robert Hart
Melbourne, Victoria, Australia October 1996
9. The mail2news.pl script
______________________________________________________________________
#!/usr/bin/perl
($program = $0) =~ s%.*/%%;
#( $version ) = $] =~ /(\d+\.\d+).*\nPatch level/;
#die "$program: requires at least version 3 of perl\n"
# if $version < 3;
# $inews = "/usr/bin/inews";
# $iopts = "-h -o \"mail2news gateway\"";
$inews = "/usr/bin/rnews";
$iopts = "";
$postinghost = "your.news.server";
if ($#ARGV < 0) {
# $newsgroup = "test";
# we'll expect the newsgroup line in the body
} elsif ($#ARGV == 0) {
$newsgroup = $ARGV[0];
} else {
die "usage: $program [newsgroup]\n";
}
# in case inews dumps core or something crazy
$SIG{'PIPE'} = "plumber";
sub plumber { die "$program: \"$inews\" died prematurely!\n"; }
open (INEWS, "| $inews $iopts") ||
die "$program: can't run $inews\n";
# header munging loop
while () {
last if /^$/;
# transform real from: line back to icky style
s/^From:\s+(.*) <(.*)>/From: $2 ($1)/;
s/Message-Id/Message-ID/;
# transform from_ line to path header; also works locally
s/^From\s+(\S+)@(\S+).*/Path: $2!$1/
|| s/^From\s+(\S+)[^@]*$/Path: $1\n/;
print INEWS
# if /^(Date|From|Subject|Path|Newsgroups|Organization|Message-ID):/i;
if /^(Date|From|Subject|Path|Newsgroups|Message-ID):/i;
$saw_subject |= ( $+ eq 'Subject' );
$saw_msgid |= ( $+ eq 'Message-ID' );
# $saw_newsgroup |= ( $+ eq 'Newsgroups' );
}
warn "$program: didn't expect newsgroup in both headers and ARGV\n"
if $newsgroup && $saw_newsgroup;
die "$program: didn't get newsgroup from either headers or ARGV\n"
unless $newsgroup || $saw_newsgroup;
$approved = $newsgroup;
$approved =~ s/\./'-'/eg;
($sec,$min,$hour,$mday,$mon,$year)=localtime(time);
$madeupid = "\<$year$mon$mday.$hour$min$sec.$$\@kepler.hedland.edu.au\>";
printf INEWS "Newsgroups: %s\n", $newsgroup if $newsgroup;
printf INEWS "Approved: %s\@kepler.hedland.edu.au\n", $approved;
print INEWS "Subject: Untitled\n" unless $saw_subject;
printf INEWS "Message-ID: %s\n", $madeupid unless $saw_msgid;
printf INEWS "NNTP-Posting-Host: %s\n", $postinghost;
print INEWS "Organisation: (mail2news gateway)\n";
print INEWS "\n";
print INEWS while ; # gobble rest of message
close INEWS;
exit $?;
______________________________________________________________________