Article View: news.software.nntp
Article #38793Re: sendmail to newsgroup - how ?
From: Jon Bell
Date: Thu, 22 Jul 1999 00:00
Date: Thu, 22 Jul 1999 00:00
46 lines
2601 bytes
2601 bytes
In article <7n6h7u$7qa$1@news.su.se>,
Glenn White <glenn@white.demon.co.uk> wrote:
>
>I have a perl script running from a cgi-bin which sends emails via the usual
>lines:
>
>$mailprog = '/usr/lib/sendmail';
>$rec = 'someone@somewhere.come';
>open (MAIL, "|$mailprog $rec") || die "Can't open $mailprog!\n";
>print MAIL "Reply-to: mailto:abc.com\n;
>print MAIL "Subject: A message\n";
>print MAIL "From: fred @abc,com\n";
>print MAIL "$FORM{'comments'}"; # comments comes from a web form
>close (MAIL);
>
>This works fine for emails. However, I want to use this for posting to a
>newsgroup.
News is not mail. Instead of 'sendmail', use whatever software on your
server injects a message into a news server, analogously to the way
sendmail injects a message into the mail stream. Ask your Web server's
admin if 'inews' or something similar is available. If so, you can use
something similar to the script above, with
open (NEWS, "|$newsprog") or die "Can't open $newsprog!\n";
On my system, $newsprog would be "/local/bin/inews -h", but on yours the
path will very likely be different (if indeed inews is installed). Then
in addition to the other stuff, print a "Newsgroups:" line as part of the
header.
'inews' is normally installed with a default NNTP server configured into
it, for that particular site. If yours isn't, or if you need to use a
different NNTP server, set the NNTPSERVER environment variable.
If your server *doesn't* have something like 'inews' on it, maybe your
server has the Net::NNTP Perl module installed (I think that's what it's
called), but I've never used that.
--
Jon Bell <jtbell@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
[ Information about newsgroups for beginners: ]
[ http://www.geocities.com/ResearchTriangle/Lab/6882/ ]
Technical Details
Message-ID:
<FF9tMI.4GF@presby.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<7n6h7u$7qa$1@news.su.se>Show Full Headers
Complete Article Headers
Message-ID: <FF9tMI.4GF@presby.edu> Subject: Re: sendmail to newsgroup - how ? Date: Thu, 22 Jul 1999 00:00:00 +0000 From: jtbell@presby.edu (Jon Bell) References: <7n6h7u$7qa$1@news.su.se> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 503980644 X-Nntp-Posting-Host: 192.168.253.29 Sender: news@presby.edu (Usenet News) Organization: Presbyterian College, Clinton SC, USA Content-Type: text/plain Mime-Version: 1.0 Newsgroups: news.software.nntp