Bug 57776 - html e-mail conversion to plain text
Summary: html e-mail conversion to plain text
Status: RESOLVED DUPLICATE of bug 44880
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.5
Platform: RedHat Enterprise Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-27 19:13 UTC by Eric Wilhelm
Modified: 2007-09-14 12:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Wilhelm 2003-04-27 19:13:32 UTC
Version:           1.5 (using KDE 3.1-1)
Installed from:    Red Hat Linux 7.3
Compiler:          gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113.0)
OS:          Linux (i686) release 2.4.18-3smp

I would like kmail to have an option to always convert html mail to plain text (removing the html tags).  The original html message could be stored in a separate folder with a link to that file listed in the converted plain-text e-mail.  Example:  "This message was originally sent in html format.  The original is located at  file:~/Mail/html/message_name.html"

Kmail currently does not render "file:/" links in plain-text mail.  But this seems like a simple extension of the current behavior of rendering www and http links.

Here is a perl script that might work as a start.  I am not a professional regex author, so it could use some improvement, but it does a decent job of conveying what I mean by this wishlist item.

------start script----------
#!/usr/bin/perl

$homedir = $ENV{HOME};
$infile = $ARGV[0];
open(FILE, "$infile");

$message = join("", <FILE>);
$message =~ s/<.*?img.*?src="(.*?)".*?>/\n\tattached image:  $1\n/isg;
$message =~ s/<a\s*href="(.*?)".*?>/ ($1) /ig;
$message =~ s/&nbsp;/ /ig;
$message =~ s/&amp;/&/ig;
$message =~ s/=\n+/\n/gs;
$message =~ s/<.*?>/ /sg;
$message =~s/\n\s*\n+/\n\n/g;

print "This message converted from html format to plain text\n";
print "To view the original, see file:/$homedir/Mail/html/$infile\n";

print "$message\n";
------end script----------

I'm sure this could be greatly improved by utilizing an html-parsing perl module.

I think this functionality would be good for security and the stifling of the html mail fad (one of my e-mail accounts has recently "upgraded" to an ms server which converts plain-text mail to html, and no amount of riding the admins seems to lead to the problem being fixed).

Thanks,
Eric Wilhelm
Comment 1 Ingo Klöcker 2003-08-31 20:52:27 UTC

*** This bug has been marked as a duplicate of 44880 ***