procmail
[Top] [All Lists]

Re: Problem with missing "Message-ID:"

2005-04-28 09:25:56
Klaus Johannes Rusch:
Ruud H.G. van Tol:
Klaus:

/usr/bin/perl5 -n -p -e 's/^Message-Id: (.*)$/Message-Id: <$1>/'

Aaargh, please learn formail.

You did see the disclaimer that a Perl solution was overkill for this,

You did see my please. Disclaimers are bad too. If one needs to
go from A to B and does not mind visiting every other imaginable
(or not even that) location, then one could just start walking.

I feel strongly that suggesting perl (or sed) to simply change a
header (as is the current context), should be discouraged on the
procmail-list. Because procmail and formail are what this list
is about.

Even a disclaimer such as '(untested)' (without giving a reason)
is never nice. A tested version:

  :0 fhw  # beware: allows an empty <>
  * ! ^Message-Id:.*<.*>
  *   ^Message-Id:.*\/[^  ]+
  | formail -i "Message-Id: <$MATCH>"

(I found out that the < and > should not be escaped.)

This will present the value of the original 'Message-Id' field
in an Old-Message-Id: header (see -i in man formail).

I chose -i because I prefer such traceable changes.

-- 
Grtz, Ruud


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>