On Sat, 2010-01-30 at 19:19 +0100, Ruud H.G. van Tol wrote:
Michelle Konzack wrote:
I am fetching the HTML-Page from the link in the mail, strip it down and
add it to the original Mail which allow me to read faster news and have
not to use a web browser. :-D
I am working on a solution to strip the HTML files in the first TMPVAR,
but this is a little bit complicate... and a VERY long line of code!
There are several programs already available that you can call from
procmail for this:
w3m -> http://w3m.sourceforge.net/
w3mmee -> http://pub.ks-and-ks.ne.jp/prog/w3mmee/
links -> http://links.sourceforge.net/
elinks -> http://elinks.or.cz/about.html
html2text -> http://man-wiki.net/index.php/1:html2text
lynx -> http://man-wiki.net/index.php/1:lynx
Here is a recipe where I am using html2text:
# excerpt from procmail.rc:
# We need a bigger buffer, this gives us twice the size of the e-mail
plus another 2048 bytes, which should be plenty
# Reason: the mime recursion reads the e-mail into variables, and then
operates with those variables
:0
* 2048^0
* 1^1 > 1
* 1^1 > 1
{
BIGGER_BUFFER = $=
LOG="$_: Setting LINEBUF to $BIGGER_BUFFER$NL"
LINEBUF = $BIGGER_BUFFER
}
# This converts the e-mail to text/plain, if it can.
INCLUDERC=/home/rln/bin/swa-make_plain.rc
# excerpt from swa-make_plain.rc
:0
* MIME_ENTITY_SUBTYPE ?? ^^\/html^^
{
# Generate new headers
# Append \'s to all but last header line (needed for i command of
sed)
# replace "html" with "plain"
H_HTML=`/bin/echo "$MIME_ENTITY_HEADER" | /bin/sed -e '$!s/^\(.*
\)$/\1\\\/;s/html/plain/ig'`
# Plug new headers into main header, remove duplicate content headers
:0 fhw
| /bin/sed '$i\'"$H_HTML" | /usr/bin/formail -f -U 'Content-Type' -U
'Content-Transfer-Encoding'
# Extract the html ( with html2txt )
:0 fbwi
| /bin/echo "$MIME_ENTITY_BODY" \
| /bin/sed -f /home/rln/bin/free-entity.sed \
| /usr/bin/html2text -rcfile ${RL_HOME}/etc/custom.style -nobs -width
${BIGGER_BUFFER}
PLAIN_TEXT=yes
}
--
JW Simpson <john(_at_)swajime(_dot_)com>
SwaJime's Cove℠
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail