This is mailformat, the mbox to html pretty formatter.
There are two versions of this software, one written in php, and one written
in the superior python.
Okay, so maybe it's not superior, but it's prettier I think.
mailformat.php
==============
This is the inital version of the script. If you have php running on your
webserver, just pop it in and go. It will look in the mail directory relative
to where the script is located.
If you are using apache with mod_rewrite, you can add a little magic to make
url's look prettier. Normally they will be something like:
http://teh.entar.net/~dave/mailformat.php?name=mail/ha-ha-the-world
but if you add the following lines to your .htaccess:
(Assuming you place the script in $HOME/public_html, and have a subdirectory
"mai"l in same)
RewriteEngine On
RewriteBase /~dave/
#Format mail nicely:
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule (^mail/.+)$ mailformat.php?name=$1
it will cause all requests to
http://teh.entar.net/~dave/mail/ha-ha-the-world
to be rewritten to
http://the.entar.net/~dave/mailformat.php?name=ha-ha-the-world.
Thus you can have your mail directory indexed, and when you click on a mail,
you get a nice pretty printed message. You can customize colors by editing
the appropriate variable in mailformat.php. If you want to change the name of
the directory you keep your mail in, you need to change the above regex, as
well as edit the corresponding regex in mailformat.php.
mailformat.py
==============
This is the much more modern and industrial mailformat. With it, you can use
the power of Python to perform your bidding. Or at least colorize your mail.
It works very similarly to mailformat.php, except that it has both a
mod_python harness, and a cgi harness.
To use the mod_python version, you need to add a few lines to .htaccess:
AddHandler python-program .py
PythonHandler handler
and if you want the mod_rewrite stuff:
RewriteEngine On
RewriteBase /~dave/
#Format mail nicely:
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule (^mail/.+)$ mailformat.py?name=$1
The code in handler.py specifically checks for mailformat.py as the name of
the script, you can of course change that by editing it. For further
information, read the docs for mod_python.
To use the cgi version, simply make sure mfcgi.py is executable, and make sure
that the .py extension is mapped to a cgi script in your web server
configuration.
AddHandler cgi-script .py
or something to that effect.
mailformat.py comes with a stylesheet (mailformat.css) to specify coloring,
with some sensible defaults already available. Stylesheet name/location is
configurable in mfcgi.py, and in mailformat.py for the mod_python version.
Have fun!