A number of peaple have asked me to send a copy or to repost my script.
Here it is. Have fun.
Cees,
-- Forwarded message from Cees van de Griend <[EMAIL PROTECTED]> --
Date: Thu, 25 Feb 1999 17:09:19 +0100
From: Cees van de Griend <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: [SuSE Linux] posting of html email
On Mon, Feb 15, 1999 at 04:49:19PM -0800, [EMAIL PROTECTED] wrote:
>> I have problems reading html email that is posted to suse-linux-e.
>> Would it be possible to have people post only test email to the list?
>>
>> I appreciate any flexibility people could have in this matter.
>
> HTML is regarded by many as annoying and rude to post to a mailing list;
> ESPECIALLY a Unix/Linux one.
>
> Personally, I just delete it.
HTML mail is no problem if you have an entry in your mailcap file.
This is a list with many new users, so the users with experience can
simply addjust theis mailcap.
Add:
-----
text/html; html2txt; copiousoutput
-----
to ~/.mailcap and put the Perl-script (attached) into your path.
I hope this small script is usefull.
It just requires 'lynx' and 'perl'.
Greetings, Cees.
--
wej Heghchugh vay', SuvtaH SuvwI'.
A warrior fights to the death.
Mark Okrand, "Star Trek: The Klingon Way - A Warrier's Guide"
#!/usr/bin/perl
# !/usr/bin/perl -w
#-------------------------------------------------------------------------
# File: html2txt.pl
# Author: Cees van de Griend <[EMAIL PROTECTED]>
# Copyright: (c) 1999 C.A. van de Griend
# Date: 19990225
# Version: 1.10
# Description: Transform a HTML-file to a TXT-file.
# ------------------------------------------------------------------------
# use strict;
# use diagnostics;
# my $DEBUG = 1; # I want debug information...
my $DEBUG = 0; # I don't want debug information...
#
# MAIN
#
{
my @text = (); # array: @text
my $lynx = "/usr/bin/lynx"; # program: lynx
my $html = "/tmp/html2txt.$$.html"; # filename: html
my $text = "/tmp/html2txt.$$.txt"; # filename: text
#
# Lynx can only read 'real .html text-files', i.e.
# - a regular text file
# - with extention .html
# So save STDIN in the file $html.
#
# N.B.: $_ is the default variable.
#
open HTML, ">$html" or die "Can't open $html: $!";
while (<>) { # read STDIN into $_
print HTML $_; # write to $html
}
close HTML or die "Can't close $html: $!";
#
# Read STDIN from 'lynx'.
# Save the read line into the array: @text.
# Write the read line to STDOUT.
#
open LYNX, "$lynx -dump $html|" or die "Can't open $lynx: $!";
while (<LYNX>) { # read $_ from 'lynx'
push @text, $_; # add read line into array @text
print $_; # write read line to STDOUT
}
close LYNX or die "Can't close $lynx: $!";
#
# If debug, save the array @text into the file $text.
#
if ($DEBUG) {
open TEXT, ">$text" or die "Can't open $text: $!";
foreach (@text) { # get line in $_
print TEXT $_; # write line to $text
}
close TEXT or die "Can't close $text: $!";
}
exit;
}
#-------------------------------------------------------------------------
# Log:
# 19990225 First version.
#-------------------------------------------------------------------------
----- End forwarded message -----
--
'utbe' bel.
Pleasure is nonessential.
Mark Okrand, "Star Trek: The Klingon Way - A Warrier's Guide"
-
To get out of this list, please send email to [EMAIL PROTECTED] with
this text in its body: unsubscribe suse-linux-e
Check out the SuSE-FAQ at http://www.suse.com/Support/Doku/FAQ/ and the
archive at http://www.suse.com/Mailinglists/suse-linux-e/index.html