Article View: news.software.nntp
Article #1129Re: sending a mail file to inews
From: Juan Gabriel Ruiz Pinto
Date: Tue, 16 Apr 1991 22:51
Date: Tue, 16 Apr 1991 22:51
143 lines
4495 bytes
4495 bytes
dcox@ssd.kodak.com (Don Cox (253-7121)) writes:
>Is it possible to send a mail file through inews and have it posted
>to a newsgroup? The following is a mail message I received:
Is not easy as just send the mail to inews and post it, the
news articles need more headers, I use a perl script to change
listserv mail articles for a local group to a newsgroup, next
is the script, maybe it helps you. (if you have perl of course)
-----------------------------------------------------------------------
#! /usr/local/bin/perl -s
# Recibe articulos de BIT-CLUB via mail
$encontre = 0;
$lineas = -1;
while ( $linea = <> ) {
if ( $linea =~ /^From:/ ) {
chop($linea);
$linea_from = $linea unless $linea_from;
}
elsif ( $linea =~ /^Path:/ ) {
chop($linea);
$path = $linea unless $path;
@auxx = split(/ +/,$path);
$path = join(" ",@auxx[1..$#auxx]);
$path =~ y/A-Z/a-z/;
}
elsif ( $linea =~ /^Distribution:/ ) {
chop($linea);
$distribution = $linea unless $distribution;
}
elsif ( $linea =~ /^References:/ ) {
chop($linea);
$references = $linea unless $references;
}
elsif ( $linea =~ /^Subject:/ ) {
chop($linea);
$linea_subject = $linea unless $linea_subject;
@aux = split(/ +/, $linea_subject);
$subject = join(" ",@aux[0..$#aux]);
}
elsif ( $linea =~ /^Date:/ ) {
chop($linea);
$linea_date = $linea unless $linea_date;
}
elsif ( $linea =~ /^Organization:/ ) {
chop($linea);
$linea_organization = $linea unless $linea_organization;
@aux = split(/ +/, $linea_organization);
$organization = join(" ",@aux[0..$#aux]);
}
elsif ( $linea =~ /^Message-Id:/ ) {
chop($linea);
@aux = split(/ +/, $linea);
$messageid = join(" ",@aux[0..$#aux]) unless $messageid;
}
elsif ( $linea =~ /^Newsgroups: / ) {
chop($linea);
@aux = split(/ +/, $linea);
$newsgroups = join(" ",@aux[0..$#aux]) unless $newsgroups;
}
elsif ( $linea =~ /^\n/ ) {
$encontre = 1;
}
if ( $encontre ) {
$lineas++;
chop($linea);
$texto[$lineas] = $linea;
}
}
if ( $linea_from =~ />$/ ) {
@from = split (/</, $linea_from);
@aux = split(/ /, $from[0]);
$nombre = join(" ",@aux[1..$#aux]);
@aux = split(/>/, $from[1]);
$origen = $aux[0];
}
else {
@from = split (/ +/, $linea_from);
$nombre = "sin nombre";
$origen = $from[1];
}
if ( $origen =~ /%/ ) {
@aux = split(/@/, $origen);
@aux = split(/%/, $aux[0]);
$origen = join("@",@aux[0..$#aux]);
}
@aux = split(/@/, $origen);
$userid = $aux[0];
@aux = split(/\./, $aux[1]);
$nodo = $aux[0];
$nodo =~ y/A-Z/a-z/;
if ( !$path ) {
if ( $nodo !~ /^mtecv2/i ) {
$path = $nodo . "!" . $userid;
$path =~ y/A-Z/a-z/;
}
else {
$path = $userid;
$path =~ y/A-Z/a-z/;
}
}
@aux = split (/ +/, $linea_date);
$date = join(" ",@aux[2..$#aux]);
if ( !$subject ) {
$subject = "Subject: (sin titulo)";
}
if ( !$newsgroups ) {
$newsgroups = "Newsgroups: itesm.bit-club";
}
$origen =~ y/A-Z/a-z/;
print <<EOT;
Path: $path
From: $origen ($nombre)
$newsgroups
$subject
$messageid
Date: $date
Approved: news@mtecv2.mty.itesm.mx
EOT
if ( $organization ) {
print "$organization\n";
}
for ($i = 0; $i <= $#texto; $i++) {
print "$texto[$i]\n";
}
--
Juan Gabriel Ruiz Pinto Internet:
Ing. Sistemas Electronicos jgabriel@mtecv2.mty.itesm.mx
I.T.E.S.M. Campus Monterrey
Technical Details
Message-ID:
<3180@mtecv2.mty.itesm.mx>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!mtecv2!jgabrielReferences:
<1991Apr15.233624.11811@ssd.kodak.com>Show Full Headers
Complete Article Headers
Message-ID: <3180@mtecv2.mty.itesm.mx> Subject: Re: sending a mail file to inews Date: Tue, 16 Apr 1991 22:51:12 +0000 From: jgabriel@mtecv2.mty.itesm.mx (Juan Gabriel Ruiz Pinto) References: <1991Apr15.233624.11811@ssd.kodak.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!mtecv2!jgabriel Newsgroups: news.software.nntp,news.software.b Followup-To: news.software.nntp Distribution: na Organization: ITESM. Campus Monterrey Lines: 142