🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
2 messages
2 total messages Started by Glenn White Thu, 22 Jul 1999 00:00
sendmail to newsgroup - how ?
#38810
Author: Glenn White
Date: Thu, 22 Jul 1999 00:00
48 lines
2311 bytes
This email relates to sending an email to a newsgroup through an nntp
server, from a Perl/CGI script.

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.
This script for emails obviously runs through an smtp mailer. However, I
presume
that for newsgroups, the posting must go through an nntp server (such as
news.somewhere.com).   I'd be very grateful if someone could please explain
how I configure the headers so the the message to correctly submit the
message to a newsgroup using this technique. I have tried adding

print MAIL "Newsgroups: alt.test";

but this doesn't do anything. I also don't have send2mail, postie or imap
available.

Should I be setting something in for the $rec contents like
news.somewhere.com
or alt.test@news.somewhere..com ??? or should I be sending it in a
different way ?

I understand how to do this using anonymous remailers, but since we are
not trying to spam, I see no point in trying to hide our company
information,
nntp mail servers, ISP etc ... and would rather find an upfront way to do
this
directly from a perl script.

Many thanks

Glenn White



Re: sendmail to newsgroup - how ?
#38793
Author: Jon Bell
Date: Thu, 22 Jul 1999 00:00
46 lines
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/ ]

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads