Article View: comp.mail.misc
Article #237Re: Delimiter of a standard mail spool file.
From: John Stanley
Date: Fri, 10 Apr 1992 18:14
Date: Fri, 10 Apr 1992 18:14
59 lines
1800 bytes
1800 bytes
In article <1992Apr10.010511.11691@wam.umd.edu> elitman@wam.umd.edu (Eric A. Litman) writes:
>Could somebody please tell me what the standard delimiter of a mail
>spool file is?
/^From /
>P.S. If somebody has already written something to do this (preferrable in
>C, that would be nice, too :-)
Uggg. You probably put iron rimmed wagon wheels on your car, too.
Perl follows:
#!/usr/local/bin/perl
# scan a mail file for mail
# I am tired of mail's format and speed (lack of).
$mail = "/usr/spool/mail/@ENV{'USER'}";
if( $#ARGV == 0 ) { $mail = shift; }
$count = 1;
open( MAIL, $mail ) || die "No mail for you.\n";
while( 1 ) {
while( <MAIL> ) {
if( eof ) { exit 0; }
do {
$pathfrom = $1;
$status = $from = $subject = "";
while( <MAIL> ) {
chop;
$from = $' if /^From: /;
$subject = $' if /^Subject: /;
$status = $' if /^Status: /;
last if /^$/;
}
$_ = $from;
$from = $1 if /(<\S+>)/;
$from = "<$1>" if /([\w-\.]+)\s+\(/;
$status = "N" if $status eq "";
$line = sprintf ("%2s %2d: %s From: %s (%s)",
$status, $count, $subject, $from, $pathfrom);
print substr($line, 0, 75);
print "\n";
$count++;
} if /^From (\S+)/;
}
}
Technical Details
Message-ID:
<1992Apr10.181432.14869@talon.ucs.orst.edu>Path:
arc1-ca.pugleaf.net!sparky!news.UU.NET!ogicse!orstcs!orstnews!ruby!stanleyReferences:
<1992Apr10.010511.11691@wam.umd.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!news.UU.NET!ogicse!orstcs!orstnews!ruby!stanley From: stanley@ruby.OCE.ORST.EDU (John Stanley) Newsgroups: comp.mail.misc Subject: Re: Delimiter of a standard mail spool file. Message-ID: <1992Apr10.181432.14869@talon.ucs.orst.edu> Date: 10 Apr 92 18:14:32 GMT Article-I.D.: talon.1992Apr10.181432.14869 References: <1992Apr10.010511.11691@wam.umd.edu> Sender: usenet@talon.ucs.orst.edu (Usenet News admin) Organization: Oregon State University, College of Oceanography Lines: 59 Nntp-Posting-Host: ruby.oce.orst.edu