Mail HTML Translator

The Mail to HTML translator is quick and dirty program I wrote to translate a mailbox file (generated by sendmail, for example), into hypertext.

The program creates a "top" page that is an unordered list of all the mail messages in the file. Each of these is an anchor to an individual file that corresponds to each mail message.

Each of the individual files is very simple; just plaintext.

Files

The files are:

Making

To make, first edit the following line in the mail2html.h:

#define BASE_NAME "/usr2/tlg/html"

to reflect where the top mail pages will reside when the program is executed.

In addition, you can edit the lines that define the bitmap that appears on each top page and the footer that appears on each.

Edit the makefile CC line to include either author, date, or both along with the subject line. The default is date but on author (keeps line short)

That's all. After that, type make and the executable called mail2html will be created. You can put this executable anywhere since all file references come from command line arguments.

Running

To run, type:

mail2html <input filename> <output filename> <subdirectory>

where input filename is the mail file to translate, output filename is the top page html file that contains an unordered list of the messages contained in the input filename, and subdirectory is the name of the subdirectory underneath which the individual mail message files will be placed.

The subdirectory allows for many mailboxes to be stored at the same time and accessed from separate top page lists. You might have an mbox, an mbox_personal, etc. By running mail2html on each of these, you have separate top pages for each. Then, put a hyperlink to each for access to the mail files underneath. This subdirectory must exist or mail2html will not be successful. If you try running mail2html without the named subdirectory, simple create it and run again ;)

Example

Suppose you have two incoming mailboxes, called mbox and mbox_old. To create two HTML documents that have hyperlinks to the messages in mbox and mbox_old, follow the steps below (assuming you've just obtained the files):

Assumptions

Assume that you wish the top pages to reside in /home/foobar/html and both mailboxes are in /home/foobar.

Steps

  1. Edit mail2html.h and change the line #define BASE_NAME "/usr2/tlg/html" to #define BASE_NAME "/home/foobar/html"
  2. Type make
  3. Type mkdir /home/foobar/html/mbox /home/foobar/html/mbox_old
  4. Type mail2html /home/foobar/mbox /home/foobar/html/mbox.html mbox
  5. Type mail2html /home/foobar/mbox_old /home/foobar/html/mbox_old.html mbox_old
  6. Insert hyperlinks to the mbox.html and mbox_old.html docs.
That's it! If you have any problems, either drop me an e-mail at tlg@pc3q.corp.harris.com or, if you run XMosaic, tack an annotation on my home page, which can be accessed by clicking

Tom Georges