HTML emails in Pegasus Mail 3.50 on FreeDOS

Pmail works well on FreeDOS if you use some great new tools to grab and send the mail.  But a lot of emails are written in HTML these days, and old Pmail does not render that (current Pmail does, I hasten to add). FLmail does, but it does so somewhat slowly. In Pmail, if an email is all HTML gobbage, and I can be bothered, I eXtract it to a file then run my little batch file:

c:\> htmemail.bat file.htm

Here is the batch file:

@ECHO OFF
COPY %1 temp$$$$.htm
REM Make sure the pattern is on a new line.
REM (And lower case.)
SED -i "s/HTML/html/g" temp$$$$.htm
SED -i "s/<html/\n<html/g" temp$$$$.HTM
REM Then delete the lines in front of the pattern
VIM  -c "g/<htm/1,-1d" -c "wq" temp$$$$.htm
REM Then view it
CALL LINKSG temp$$$$.htm
REM Then delete the copy
DEL temp$$$$.htm

It uses DOS versions of SED and Vim. SED does a nice job of preparing the file — changing HTML to html to simplify the next line, then making sure that the <html> token appears on a new line by finding it in the file and prepending a newline (\n) character; note that this requires GNU SED, and BSD SED works differently.

PMAIL (Pegasus mail)

The VIM editor is also used as a command line processor, so this needs VIM.EXE and SED.EXE to be in the PATH. VIM is part of FreeDOS.

(Some HTML emails seem to be just one long line of stuff, which is why I search for<html> and replace it with itself prefixed by \n (newline), which makes sure the pattern is on a new line.)

Then the VIM incantation finds the pattern and deletes everything in front of it. This may not always be needed — many HTML viewers can ignore the cruft before <html>, but I found that LINKS was sometimes seeing the crap at the front as indicative that the file was a plain text file, and then rendering it accordingly…

Note that LINKSG.BAT is just a batch file to call the graphical interface version of LINKS:

c:\net\links\links -g -mode 1024x768x32k %1 %2 %3

And here is the SED information, for reference:

c:/freedos/bin/sed (GNU sed) 4.2.2
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Jay Fenlason, Tom Lord, Ken Pizzini,
and Paolo Bonzini.
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <bug-sed@gnu.org>.
Be sure to include the word ``sed'' somewhere in the ``Subject:''
field.

Author: Darren

I'm a scientist by training, currently working as a writer, trainer and editor.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.