| Category: | E-Mail Programs. |
| Author/Contact Info | merlyn |
| Description: | Durn it if there seems to be no way for Outlook with Win2K to turn off that evil "HTML version" of mail. A MIME is a terrible thing to waste, so let's strip that as it comes in. Set up a procmail recipe to pipe mail that has both boundary and html in its content-type header through this program, and you'll never have to deal with that evil embrace-and-extend garbage from Redmond again.
It's safe to pipe all mail through this, if you don't want to be clever with procmail. You also might want to do something sensible with the die there. I put the hook there just in case, although all I'm doing is re-throwing it. Requires MIME::Tools. See also the column I wrote around this program. |
#!/usr/bin/perl -w
use strict;
$|++;
my $envelope = <STDIN>;
use MIME::Parser;
use MIME::Entity;
my $parser = MIME::Parser->new;
$parser->output_to_core(1);
$parser->tmp_to_core(1);
my $ent = eval { $parser->parse(\*STDIN) }; die "$@" if $@;
if ($ent->effective_type eq "multipart/alternative"
and $ent->parts == 2
and $ent->parts(0)->effective_type eq "text/plain"
and $ent->parts(1)->effective_type eq "text/html") {
my $newent = MIME::Entity->build(Data =>
$ent->parts(0)->body_as_string .
"\n\n[[HTML alternate version delet
+ed]]\n");
$ent->parts([$newent]);
$ent->make_singlepart;
$ent->sync_headers(Length => 'COMPUTE', Nonstandard => 'ERASE');
}
print $envelope;
$ent->print;
|
|
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strip Brain-Damaged Mails of "HTML Alternative" Evilness
by Fastolfe (Vicar) on Jan 24, 2001 at 07:49 UTC | |
|
Re: Strip Brain-Damaged Mails of "HTML Alternative" Evilness
by strredwolf (Chaplain) on Jan 24, 2001 at 08:08 UTC | |
|
Re: Strip Brain-Damaged Mails of "HTML Alternative" Evilness
by Anonymous Monk on Jan 26, 2002 at 01:20 UTC | |
|
Re: Strip Brain-Damaged Mails of "HTML Alternative" Evilness
by marius (Hermit) on Jan 23, 2001 at 00:01 UTC | |
by gaudior (Pilgrim) on Jan 23, 2001 at 00:15 UTC | |
by marius (Hermit) on Jan 23, 2001 at 00:21 UTC | |
by gaudior (Pilgrim) on Jan 24, 2001 at 20:00 UTC |