On Wed, Jan 06, 1999 at 09:18:42PM +0100, Mirko Zeibig wrote:
> I now use this alias-definition to post every mail to a list to a
> newsgroup as well. Any ideas to do this more efficient?

> ** /var/qmail/alias/.qmail-all **
> | { echo "Newsgroups: local.announce"; cat - } | sed '/^Received:/d' |
> sed '/^\ \ by\ unknown\ with\ SMTP/d' | rpost localhost -M
> &member1
> &member2
> &member3

Efficient how?  Don't you want it to be correct and stable?

I wrote the following bit of code yesterday using Russ' News::Gateway
perl module for channelling a mailing list into a newsgroup (reverse is
done using some INN magic and a cunning use of approved headers).

I'd much rather make sure the contents of various RFC822 headers are
compliant to RFC1036 (and compatible with the more widespread broken
newsservers...) than whether it's "more efficient".  How many messages
do you post to the newsgroup anyway?  I'm sure the efficiency of this
script won't even be a problem at a couple of new messages a minute...

----------------------------------------------------------------------
#!/usr/local/bin/perl -w
use strict;

use News::Gateway;

my $server   = 'news.server';
my $postto   = $ARGV[0] || "local.test";

my $gateway = new News::Gateway->new(0, '[EMAIL PROTECTED]');

$gateway->modules('headers', mailtonews => [$postto]);
$gateway->config_file(\*DATA);

$gateway->read(\*STDIN);

my $error = $gateway->apply();
unless ($error) {
    $error = $gateway->post($server);
    print $error if $error;
}

__END__
header approved     reject
header approved     add     [EMAIL PROTECTED]
header newsgroups   drop
header cc           drop
header to           drop
header path         replace mjolner.dk!mail-to-news
header message-id   rename
----------------------------------------------------------------------
-- 
Lars Balker Rasmussen, Software Engineer, Mjolner Informatics ApS
[EMAIL PROTECTED]

Reply via email to