Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Script to Remove HTML Code in Email ??

50 views
Skip to first unread message

nos...@notreal.com

unread,
Apr 20, 2012, 11:58:35 PM4/20/12
to
Is there anyone here that knows of a program or script that you can run
periodically with cron that will remove the all the HTML formatting code
in a users incoming mail file located in /var/spool/mail?

Robert Bonomi

unread,
Apr 21, 2012, 3:08:42 AM4/21/12
to
A) 'cron' is the wrong way to attack the problem. Use a procmail recipe
to detect HTML-formatted messages as received, and process them
at the time they are received.

B) There is a program called "demime" that will 'do the right thing'
for HTML messages -- if the message is multipart/alternative, it
will discard the 'text/html' part in favor of the 'text/plain' part;
if there is -only- an HTML component, it uses the 'lynx' web browser,
in non-interactive mode, to 'render' the incoming message into formatted
_plain-text_ and saves *that* in the user's inbox.

I have used demime -- invoked from procmail -- for this purpose, for years.

Kees Theunissen

unread,
Apr 21, 2012, 7:29:29 AM4/21/12
to
Yes, this really should be done when a message arrives.
And if wou want to clean up your existing mail file(s) then 'formail'
can be used to split mail files in separate messages and pipe
those trough a process as described above.
'formail' is part of the procmail package. Look at its '-s' option.


Regards,

Kees.

--
Kees Theunissen.
0 new messages