Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

no-multipart-alternative.pl

9 views
Skip to first unread message

Richard

unread,
Sep 21, 2010, 10:16:31 PM9/21/10
to
[Please do not mail me a copy of your followup]

I found an issue with my procmail filtering and the
no-multipart-alternative.pl script I posted earlier.

It turns out that procmail gets the message in "mbox format", which
means that it starts with a line like:

From f...@bar.com

Note the lack of : on this line. This is the way that mbox format
indicates the start of a message and why bodies containing lines
beginning with the word "From" have to be escaped somehow, typically
by making them read >From instead.

Well, the perl MIME modules strip this line from the message so that
when they print the message back out (procmail treats them as a
filter), the magic mbox delimiter is missing.

If after all procmail rules are checked and no further rule delivers
the message, procmail will append the message back on to $DEFAULT,
which is usually your mailbox file in mbox format. However, the
filtering removed the "From " delimiter, so the message appears
concatenated onto the body of whatever is the last message stored in
your mailbox file.

The fix is to make the last rule of your procmailrc look like this:

# last chance, save onto $DEFAULT in mbox format
:0 H : .mbox.lock
| rcvpack $DEFAULT -mbox

This runs the rcvpack utility with the -mbox flag telling it to append
the file to $DEFAULT in mbox format.

This is a subtle detail of the way procmail works and its been biting
me for a while now. I noticed that it only seemed a problem on those
multipart messages that I was processing with this script, however it
could happen with any filtering process you perform on a message with
procmail that disturbs the mbox marker at the start of the header.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>

Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

Kevin the Drummer

unread,
Sep 29, 2010, 5:17:01 PM9/29/10
to
Richard <legaliz...@mail.xmission.com> wrote:
> The fix is to make the last rule of your procmailrc look like this:
>
> # last chance, save onto $DEFAULT in mbox format
> :0 H : .mbox.lock
> | rcvpack $DEFAULT -mbox
>
> This runs the rcvpack utility with the -mbox flag telling it to append
> the file to $DEFAULT in mbox format.

I experience that problem, with multiple messages being merged, myself.
I implemented the fix above, and will watch to see if I have the problem
again, I expect it will be OK.

Thanks!

--
PLEASE post a SUMMARY of the answer(s) to your question(s)!
Unless otherwise noted, the statements herein reflect my personal
opinions and not those of any organization with which I may be affiliated.

0 new messages