On Tue, Aug 24, 2010 at 9:27 AM, Josh Rickmar <joshua_rickmar_AT_eumx.net> wrote:
> anonymous is right, I just want to remove the text/html attachments,
> not strip the html tags.
MIME sucks; there's no nice way to deal with it. I use perl and the
Mail::Message package from cpan.
------
#!/usr/bin/perl
use Mail::Message;
my $message = Mail::Message->read(\*STDIN);
if ($message->isMultipart) {
foreach my $part ( $message->parts ) {
if ( $part->contentType eq 'text/html' ) {
$part->delete;
}
}
}
$message->print(\*STDOUT);
------
That will delete html attachments, but only from multipart messages
(so html-only mail will be left alone). You just cat the message to
it and it outputs the message (properly restructured if necessary) to
stdout
-- # Kurt H MaierReceived on Tue Aug 24 2010 - 16:45:41 CEST
This archive was generated by hypermail 2.2.0 : Tue Aug 24 2010 - 16:48:02 CEST