procmail
[Top] [All Lists]

Re: Formail issue with weird headers

2001-11-24 21:11:02
On 24 Nov, CaT wrote:
| I have a message that begins like this:
| 
| >From linux-kernel-owner(_at_)vger(_dot_)kernel(_dot_)org  Sat Nov 24 
11:27:02 2001
| >From hogarth  Sat Nov 24 11:27:02 2001
| Return-Path: <linux-kernel-owner(_at_)vger(_dot_)kernel(_dot_)org>
| Received: from localhost (root(_at_)localhost [127.0.0.1])
|         by theirongiant.weebeastie.net (8.12.1/8.12.1/Debian -2) with ESMTP 
id fAO0R0UL006328
|         for <hogarth(_at_)localhost>; Sat, 24 Nov 2001 11:27:02 +1100
| ...
| 
| And I'm trying to use formail to rename/get rid of the >From line but
| this:
| 
| formail -R '>From ' 'X-Exscaped-From: ' 
| 
| or any other variation does not work. From_ instead of >From_ works
| though so I know that the above is fine conceptually.
| 

If you have lines beginning ">From ", then I'd think they're probably in
the body of the message and not in the headers. If so formail won't work
and you'll have to use sed, or perl, or some other tool of your choice
as a body filter.  Something like this (untested) might work:

:0fbw
* B ?? ^>From +
| sed s/>From/X-Escaped-From:/

This will modify all such lines. If it's important to limit it just to
those that were once an envelope From line, then maybe something like:

:0fbw
* B ?? ^>From +[^       ]+ +(S(un|at)|Mon|T(ue|hu)|Wed|Fri)
|perl -pe 's/^>From *(\S+ +(S(un|at)|Mon|T(ue|hu)|Wed|Fri).*)/X-Escaped-From: 
$1/;'

-- 
Reply to list please, or append "6" to "procmail" in address if you must.
Spammers' unrelenting address harvesting forces me to this...reluctantly.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail