procmail
[Top] [All Lists]

RE: Fixing up broken headers how?

2001-12-25 11:56:27


-----Original Message-----
From: procmail-admin(_at_)Lists(_dot_)RWTH-Aachen(_dot_)DE
[mailto:procmail-admin(_at_)Lists(_dot_)RWTH-Aachen(_dot_)DE]On Behalf Of 
Trevor Jenkins
Sent: Tuesday, December 25, 2001 2:25 AM
To: Procmail Users List
Subject: Fixing up broken headers how?


Occasionally I receive messages from a list where the original was gated
through a news server. Some (but not all) of these message arrive with
damaged headers such that most of the header lines are taken as body text.
I'd like to fix up these message so that they have correct headers.

As far as I can see the problem only affects a small group of users using
the news/mail gateway. Most message arrive unscathed. Seems to be emails
from same people that get clobbered; yet other people posting from the
same host don't exhibit this problem. Emails to the news server admin only
result in "we haven't seen this problem with anyone else's email and even
if we did we wouldn't know how to fix it" messages. So I have to put right
what went wrong for myself.

Hints of possible solutions greatly appreciated.

You might try seeing if the "digest split" option on formail will help. Copy
a test mail/news message to a file, let's call it 'msg.001', and run the
following 'formail' invocation:

  formail +1 -ds < msg.001 > msg.fixed

Then, take a look at msg.fixed to see if that's what you expect to see in a
repaired message.

The "-ds" option tells formail to look for header fields in the body and
split them out. It will look for "minfields" header fields in a row; where 2
fields is the default, and it can be changed by the "-m" option.  The +1
tells formail to skip the "first" message, which in this case is the set of
news gateway header fields that you don't care for.  When processing a real
digest mail, this would typically skip the table of contents.

Folding this into a procmail filter:

:0 f
* ^From(_dot_)*news-remailer(_at_)newsgateway(_dot_)com
| formail +1 -ds

Where "news-remailer(_at_)newsgateway(_dot_)com" is the site retransmitting the 
news
items as mail. Any criteria can obviously be used instead. This filter rule
should be near the top of your procmailrc file, ahead of your rules that
process/file normal mail messages.

Disclaimer: I haven't tested this, the example above is meant as something
you might try. Please test it first before putting it into action.


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

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