Convert a text file to html and email it

An xchg to apply to a simple text file to generate an HTML email

The aim is to get a simple text file that looks like this:

some very exciting text
some more scintillating text

and generate an html email, with the first line of text as a headline …


This requires ipsmtp to be run with a -H switch. This says that you will be providing your own header, which you will create with the xchg below …If you are already running ipsmtp, this may mean that you are adding a second instance of it in the system file.

It would be something link this

mail	 local	ipsmtp -h mailhost -f -H

or if a second instance, perhaps it would need to spool a second queue, so would be

mail	 local	ipsmtp -q 2smtp2 -h mailhost -f -H

It assumes that you want the first line of text to be a headline.

Obviously, once started with this the world is your oyster, and you can produce flashing technicolour emails by applying a little HTML know-how.

In these examples, you are going to need a copy flow that will provide the person the file is to in the DA header field, and the subject in the DI header field. Alternatively you could force them in the xchg.

ipxchg – parameter files


; Turn flag 1 ON at the end of the first line											  
o +\n+1


x #1 |\n|\n

x|Text of *\n|<I><FONT COLOR="#0000cc">Text of *</FONT></I>\n
x|Excerpt from *\n|<I><FONT COLOR="#0000cc">Excerpt from *</FONT></I>

x|Source: *\n|<I><FONT COLOR="#0000cc">Source: *</I></FONT>\n


z:partial:QH	 JH,1,64
z:combie:NH	  BS,QH
z:partial:NN		ZN,1,,,,.



; end of xchg

You can see above that the xchg calls in a file … so create a file /fip/tables/xchg/HTMLEMAIL.BEFORE. Again, the metadata is optional and tunable ….

From: Lucy <>
<META NAME="Product" CONTENT="The Daily Bugle">
<META NAME="Copyright" CONTENT="The Daily Bugle">
<META NAME="Headline" CONTENT="\JH">
<META NAME="Catchline" CONTENT="\JK">
<META NAME="SourceCountry" CONTENT="\LY">
<META NAME="PublicationTime" CONTENT="\J4">
<META NAME="TimeSent" CONTENT="\$e\$y\$i\$d\$h\$n\$b">
<FONT SIZE="2" FACE="Verdana, Arial, sans-serif">


See also
* [[Create an email with an attachment]] – take a file (a jpeg say) and encode it and email it.