procmail
[Top] [All Lists]

Procmail+Email Gateway=Inn

1999-04-24 02:53:39
I stil home a problem with this script.
Soory but I can't correct it with out help.
He is some logs and script.


--/home/alex/procmail.log
procmail: No match on "^Newsgroups"
procmail: Locking "/var/spool/mail/alex.lock"
procmail: Assigning "LASTFOLDER=/var/spool/mail/alex"
procmail: Opening "/var/spool/mail/alex"
procmail: Acquiring kernel-lock
procmail: Unlocking "/var/spool/mail/alex.lock"
From news  Sat Apr 24 10:58:46 1999
 Subject: Boot-time Usenet warning on alex.dc.ukrtel.net
  Folder: /var/spool/mail/alex                                              442
procmail: Notified comsat: "alex(_at_)517:/var/spool/mail/alex"
procmail: No match on "^Newsgroups"
procmail: Locking "/var/spool/mail/alex.lock"
procmail: Assigning "LASTFOLDER=/var/spool/mail/alex"
procmail: Opening "/var/spool/mail/alex"
procmail: Acquiring kernel-lock
procmail: Unlocking "/var/spool/mail/alex.lock"
From news  Sat Apr 24 12:06:51 1999
 Subject: alex.dc.ukrtel.net Daily Usenet report for Sat Apr 24 12:05:02 GMT 19
  Folder: /var/spool/mail/alex                                             8734
procmail: Notified comsat: "alex(_at_)959:/var/spool/mail/alex"
---------end-------------------

Looks like all Ok.

----------/usr/bin/mail2news---------------------
#!/usr/bin/perl

($program = $0) =~ s%.*/%%;

#( $version  ) = $] =~ /(\d+\.\d+).*\nPatch level/;
#die "$program: requires at least version 3 of perl\n"
#        if $version < 3;

# $inews = "/usr/bin/inews";
# $iopts = "-h -o \"mail2news gateway\"";
$inews = "/usr/local/news/bin/inews";
$iopts = "";
# $postinghost = "news.dc.ukrtel.net";

if ($#ARGV < 0) {
      # $newsgroup = "test";
      # we'll expect the newsgroup line in the body
} elsif ($#ARGV == 0) {
     $newsgroup = $ARGV[0];
  } else {
   die "usage: $program [newsgroup]\n";
  }

# in case inews dumps core or something crazy
$SIG{'PIPE'} = "plumber";
# sub plumber { die "$program: \"$inews\" died prematurely!\n"; }
    sub plumber {
        if (wait() != -1) {
            $exit = sprintf("with exitcode = %d:%0o", $? >> 8, $? & 0377);
        } else {
        $exit = "but wait() failed: $!";
        }
        die "$program: \"$inews\" died prematurely $exit!\n"
    }

# open (INEWS, "| $inews $iopts") ||
#      die "$program: can't run $inews\n";
        open (INEWS, "| $inews $iopts >/tmp/rnews.log 2>&1") ||
        die "$program: can't fork: $!";

# header munging loop
while (<STDIN>) {
     last if /^$/;

     # transform real from: line back to icky style
     s/^From:\s+(.*) <(.*)>/From: $2 ($1)/;

     s/Message-Id/Message-ID/;

     # transform from_ line to path header; also works locally
     s/^From\s+(\S+)@(\S+).*/Path: $2!$1/
       || s/^From\s+(\S+)[^(_at_)]*$/Path: $1\n/;

     print INEWS
  #   if /^(Date|From|Subject|Path|Newsgroups|Organization|Message-ID):/i;
     if /^(Date|From|Subject|Path|Newsgroups|Message-ID):/i;
     $saw_subject |= ( $+ eq 'Subject' );

     $saw_msgid |= ( $+ eq 'Message-ID' );

     $saw_newsgroup |= ( $+ eq 'Newsgroups' );
  }

warn "$program: didn't expect newsgroup in both headers and ARGV\n"
      if $newsgroup && $saw_newsgroup;

die "$program: didn't get newsgroup from either headers or ARGV\n"
      unless $newsgroup || $saw_newsgroup;

$approved = $newsgroup;
$approved =~ s/\./'-'/eg;

($sec,$min,$hour,$mday,$mon,$year)=localtime(time);
$madeupid = 
"\<$year$mon$mday(_dot_)$hour$min$sec(_dot_)$$\(_at_)alex(_dot_)dc(_dot_)ukrtel(_dot_)net\>";

# printf INEWS "Newsgroups: %s\n", $newsgroup if $newsgroup;
print INEWS "Newsgroups: $newsgroup\n" if $newsgroup;
printf INEWS "Approved: %s\(_at_)alex(_dot_)dc(_dot_)ukrtel(_dot_)net\n", 
$approved;
print  INEWS "Subject: Untitled\n" unless $saw_subject;
printf INEWS "Message-ID: %s\n", $madeupid unless $saw_msgid;
printf INEWS "NNTP-Posting-Host: %s\n", $postinghost;
print  INEWS "Organisation: (mail2news gateway)\n";
print  INEWS "\n";

print INEWS while <STDIN>;   # gobble rest of message

close INEWS;
exit $?;
-----------------------end-------------------------
I don't understand this script at all!!!!!!!!
---/tpm/rnews.log
Required "Subject" header is missing or empty.
---------end-------------------------
This error is very bad. What can I do?
To: Philip Guenther - I try to do all suggestions = doesn't help.

<Prev in Thread] Current Thread [Next in Thread>
  • Procmail+Email Gateway=Inn, Alexander Belik <=