procmail
[Top] [All Lists]

Re: About HTML email recipe in pm-tips

2002-05-11 13:36:52
At 21:32 2002-05-11 +0200, Marco Fioretti did say:

recipes are badly formatted. Do you know if it works, or have
alternative working recipes to do it? I am not trying it myself yet

I use a perl script when I want to strip HTML. However, why don't you juse use lynx to preprocess the HTML body? Something like the following should do the trick:

:0bf:testfile.html$LOCKEXT
* ^Content-Type:[       ]*text/html
| cat - > lynxfile.html ; lynx -dump lynxfile.html ; rm lynxfile.html

This won't deal with multipart messages (which is why I use a perl script), but the breakdown is:

(f)ilter the (b)ody, and use a lockfile so that we're not running concurrent processes (lynx doesn't take piped input, so you need to put it into a file - furthermore, lynx expects an .html type filename extension or it won't parse it as HTML). Pipe the message into a temp file (using cat, ugly I know), then run the lynx command that transforms it, then remove the temporary file.

Arguably, if you're overwriting the temp file with the cat operation, you don't absolutely have to delete it at the end.

Try it with some standalone mailboxes in a sandbox config.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>