Here is a simple program I wrote that pipes email messages to a news
server. We are testing out the idea of concurrent qmail aliases and
local news groups and this program has been very useful. I have added the
following to a .qmail alias file:
| /usr/local/bin/q2news.pl NEWS.SERVER.HERE NEWS.GROUP.HERE
It calls the q2news.pl program whose code follows. The program requires
two perl modules which are easily found at your favorite CPAN site.
Please send me any ideas or comments, and I can add features and a README
for more formal distribution etc.
Enjoy,
Samuel Daffner
Mills College ITS
Oakland, CA
#!/usr/local/bin/perl -w
#
# q2news.pl -- Pipes mail messages to news groups
#
# by Samuel Daffner, [EMAIL PROTECTED]
# updated 5.7.99
#
########################
$news_server = @ARGV[0];
$news_group = @ARGV[1];
@body=<STDIN>;
########################
use Mail::Internet;
$mail = Mail::Internet->new(\@body);
$subject = $mail->get('Subject');
$from = $mail->get('From');
@header=("Newsgroups: $news_group");
@header=(@header,"From: $from","Subject: $subject");
########################
use News::NNTPClient;
$c = new News::NNTPClient("$news_server");
$c->post(@header, "", @body)|| print "Error posting:$!\n";
__END__