Re: MIME headers in Procmail

"David W. Tamkin" <[email protected]>
Newsgroups gmane.mail.procmail
Message-ID <[email protected]>
John Levine wrote:

> Hm, this more or less seems to work.  Ugh.
>
> :0 H
> SUBJ=| formail -fXsubject -Xfrom |perl -MEncode -ne 'print encode("UTF8",decode("MIME-Header",$_))'

I know next to nothing about perl, but can't it discard the other lines 
besides Subject: and From: and save the calls to formail and the shell?

> :0 ci
> * SUBJ ?? Subject:\/.*
> | echo "subject is $MATCH"

Where is the output of echo going?  If you're writing it to the logfile,

  :0c
  * SUBJ ?? Subject:\/.*
  LOG="subject is $MATCH
"

will be a bit more streamlined.  I'd recommend that for "from is" as well, 
but also,

> :0 ci
> * SUBJ ?? From:\/.*
> | echo "from is $MATCH"

Just in case "From:" appears in the subject and Subject: precedes From:, 
you should left-anchor the regexp in that condition:

  * SUBJ ?? ^From:\/.*

Then there's the matter of the spaces that almost always follow the colons, 
but I won't get into that.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.