<<< Date Index >>>     <<< Thread Index >>>

Re: Fwd: broken "^From " header



On Tue, Jun 15, 2004 at 10:18:34AM EDT, Ionel Mugurel Ciobica wrote:

> Hi,
> 
> I use mutt since many years now. I noticed a few months back that mutt
> can't read an e-mail where the first line is broken in two, something
> like that:
> 
> | From PLOHN@xxxxxx
> |  Thu Jun 10 00:34:34 2004

> I receive about 30-50 e-mails like that every week and the only way I
> know to fix it is to join the two lines in an editor. (J in vim).
> Half of this e-mails are spam but the other half are messages from
> discutions lists. To identify the broken ^From header I do this:
> 
> grep -a '^ [MTWFS][ouehra][neduit] [JFMAMSOND][aepuc][nbrynlgptvc] [ 
> 0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [12][09][0-9][0-9]' mail-file
> 
> Is there a way to fix that in mutt (or .procmailrc)?

I'd just write a quick little PERL script to fix the message (a small
variation on your grep above, but you only have to examine the first
line, and if you find a problem, just collapse the first two lines
[1]), and pipe all mail through it from my .procmailrc (or better, from
my /etc/procmailrc, so everybody on your server can have his emails
automatically fixed).

> P.S. I just subscribed for this message :-)

This is a good list to be on.  It's very noisy, but you wouldn't believe
how much you can learn from it.  There are some really good people here,
and then there are the really annoying li'l wankers like myself who keep
the list from getting too boring ;-P

 - Dave

[1]
Here's a little script based on your regex:
--start--
#!/usr/bin/perl
$_=<>;
chomp and $_.=" " unless (/ [MTWFS][ouehra][neduit] 
[JFMAMSOND][aepuc][nbrynlgptvc] [ 0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] 
[12][09][0-9][0-9]/);
do { print; } while (<>);
-- end --
Note that this script doesn't bother to try correcting the spacing
between the addy and the date.  It merely inserts one on the assumption
that an extra space never hurt nobody.  If that concerns you, you'll
have to treat the second line specially, too:
--start--
#!/usr/bin/perl
$_=<>;
unless (/ [MTWFS][ouehra][neduit] [JFMAMSOND][aepuc][nbrynlgptvc] [ 0-9][0-9] 
[0-9][0-9]:[0-9][0-9]:[0-9][0-9] [12][09][0-9][0-9]/) {
 chomp; $_.=" "; print; $_=<>; s/^ +//;
};
do { print; } while (<>);
-- end --

-- 
Uncle Cosmo, why do they call this a word processor?
It's simple, Skyler.  You've seen what food processors do to food, right?

Please visit this link:
http://rotter.net/israel

Attachment: pgpq2g7dQ9ErL.pgp
Description: PGP signature