[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    [Bug 57776] New: html e-mail conversion to plain text
From:       ericw () ku ! edu
Date:       2003-04-27 17:13:35
[Download RAW message or body]

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
     
http://bugs.kde.org/show_bug.cgi?id=57776     
           Summary: html e-mail conversion to plain text
           Product: kmail
           Version: 1.5
          Platform: RedHat RPMs
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: wishlist
          Priority: NOR
         Component: general
        AssignedTo: kmail@kde.org
        ReportedBy: ericw@ku.edu


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
_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic