Re: OT: Supply Missing text/plain MIME part?
- On Wed, 28 Oct 2009 14:38:12 -0500
Noel Jones <njones@...> wrote:
> I say put on your somber face and agree that Hotmal is goofedMy experience with Hotmail and other major web mail vendors is that
> up, hope they fix it soon.
they are too busy finding new and innovative ways to break email
interconnectivity to persist in any individual strategy for a
significant period of time.
That said, I seem to recall that providing a text/plain part for all
mail is best practice for M*U*As. If you want to enforce this at the
M*T*A level then I doubt there is an off the shelf solution.
So that you know what's involved...
You'll need Lynx 2.8.6+ for HTML dump with -nomargins and -notitle
switches, "path/lynx -dump -stdin -nolist -nomargins -notitle".
You have to walk the MIME structure of the message to determine that
there is a text/html part that does not have a corresponding text/plain
part, decode and render the text/html part, build a text/plain part,
build a multipart/alternative mime section and insert it into the mail
message in place of the text/HTML part. An object-oriented library may
manage MIME boundaries for you, but most scripting languages will let
you handle that little detail yourself.
Identifying MIME boundaries with a regex is non-trivial in practice.
Python mimelib is adequate, but I find the load time for the Python
interpreter to be prohibitive for mail filters, so that approach leads
you into scope creep with time spent building an SMTP relay or worse. I
have something that appears to work with the TRE regex library in
CRM-114. The top Google result for "perl mime parser" describes
MIME::Parser as an "experimental class for parsing MIME streams".
Overall, not a promising lot.