MH & nmh: Email for Users & Programmers

May, 2006

Explanation of mimecat

The Section Decoding Messages with mimecat gives an overview of this script. Here is the mimecat script (you might want to open it in a separate browser window). To install it, see the Section Programs in This Book's Archive.

mimecat writes certain MIME content-types to the standard output. You have to configure it to output the types that you want to be output. The file named by $profile contains a MIME profile; it writes the contents you choose to standard output. Contents not listed will use default rules in your MH profile or the system mhn_defaults or mhn.defaults file. Why? As explained in the Section MIME Profiles, mhn checks three profiles for an mhn-store- entry. (This script depends on nmh's compatibility with old MH syntax.) If the profile in mimecat doesn't write the content to standard output, mhn will use an entry from another profile. Because those other entries probably won't write to standard output, as you want, you need to be sure that mimecat has entries in its $profile for all types you want to output. It's ugly, but it works.

mhn -store is verbose; it always tells you what it's doing. So mimecat grabs the standard error output from mhn -store. mimecat outputs any lines from mhn that don't seem to be about storing to standard output. That is, mimecat tries to delete informational messages but show errors. You may also need to tweak this part of the script, especially if you're using nmh and its MH compatibility or the messages it prints are changed.