procmail
[Top] [All Lists]

RE: Correcting broken Message-ID:

2007-07-13 15:00:03
Michelle Konzack schrieb am Friday, July 13, 2007 4:57 PM
So, now I have in my "procmailrc" at the beginning following 
construct:

----[ '~/.procmailrc' ]-----------------------------------------
:0fhw
* ! ^Message-ID:
| formail -a Message-ID:

:0
* ! ^Message-ID:.*<.*>
{
  MSGID=`formail -czx Message-ID: |sed 's/<> //g'`
  
  :0fw
  |formail -I "Message-ID: <${MSGID}>"
}
----------------------------------------------------------------

and like to know, whether someone has a better solution for it.

Well, first of all, I'm not sure why I'm bothering to
offer help, because I doubt you'll see it: you said more
than once in the past that you trash automatically all
Microsoft-client emails, and I'm sending this from Outlook.

So if you don't reply, I'll assume you didn't see this.  Oh, well.

My first thought is, broken Message-IDs are an extremely
good indicator of spam and with low false-positive rate.
So why do you want to repair them?  Do some tiny bit of
corroboratory inspection of the message (in procmail) and
trash it as spam, which is what it almost surely is.

But if you insist -- well, you're already looking for Message-ID
in procmail, so you certainly don't need formail two separate
times in the recipe set.  Once will do.

  SHELL = /bin/sh

  :0 fw h  # in brackets just below are a space and a tab
  * ^Message-ID:.*\/[^  ].+
  * ! MATCH ?? ^^<.*>^^
  | formail -I "Message-ID: <`echo \"$MATCH\" | tr -d '> <'`>"


Tested, including on Message-IDs with whitespace and angle brackets
in the middle.  You need a Bourne-y shell for the quoted internal
quotes to work.

You could do more and not bother with the backtick stuff unless
there are internal angles or whitespace, but I'll leave that up to
you.

Dallman
____________________________________________________________
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>