I wrote this program when I needed a tool to construct MIME encoded emails
with file attachments in job scripts on a production box. Being a production
box it didn't have any development tools installed. However, the box DID have
a K&R C compiler that appears to be necessary for some administrative task or
another (configuring the kernel?). If you tried to compile even fairly simple
ANSI/ISO C source the compiler bitched and moaned about all the stuff it
didn't support, which will stop most folk (at least those who don't know
anything about the history of the C programming language) from building their
own binaries.

Since I'm old enough to actually have written C code back before we had the
ANSI/ISO standard and all the accompanying niceties, I was not stymied by
a the lack of ANSI/ISO support. It's really not all that hard to write
K&R compliant code, so long as you don't need the compiler to check your
function calls for you. For a program this small, however, that's not much
of a concern.

Since the program is meant to be compiled on systems with minimal support
(there is no telling what unrestrained IT staff will decide must be removed
in the interest of system security) I didn't bother to include a makefile.
On every system I have tried, however, the program compiled with the simple
incantation

   cc -o mime mime.c

but your selected target system may require extra special magics.

The program supports the basic MIME standard: The caller can select the
content type (application/octet-stream, text/plain, or user specified),
content type encoding (7bit, 8bit, binary, base64 or auto-detected) and
the boundary string (defaults to "=_MIME_CONTENT_BREAK_="). Further, the
caller may specify the e-mail subject, to address, from address, carbon
copy address and text for a prolog and epilog. The content type and
encoding may be specified separately for each attached file.

The program's calling format is:

   mime [-dDvV] [-S subject] [-F from-address] [-T to-address]
        [-C carbon-copy address] [-P prolog-text] [-E epiplogue-text]
        [-B boundary] {[-78abqux] [-t content-type] filename}
  
     -d   low detail debugging
     -D   high detail debugging
     -v   verbose messages
     -V   very verbose messages
  
     -7   7-bit ASCII encoding
     -8   8-bit ASCII encoding
     -a   application/octet-stream content type
     -b   binary encoding
     -q   quoted-printable encoding
     -t   text/plain content type
     -u   unknown encoding, auto-detect
     -x   base64 encoding

There's really not much to this program. Once you know how the MIME messages
are constructed you could do most of it manually (except for the base64
encoding, which would require a program like this), but if there are any
problems with it, I would like to know about them. I can be contacted at
dutky@bellatlantic.net

The output from MIME-tool is an RFC-822 formatted internet mail message and
can be fed into any mail handling program that expects such messages, such
as mail, mailx or sendmail. Here are some examples of how to use MIME-tool
with these three programs to send a MIME message containing an attached file:

	mime -S "test message" -F me@foo.net file1 | mail someone@somewhere.net
	
	mime -S "test message" -F me@foo.net file1 | mailx someone@somewhere.net
	
	mime -S "test message" -F me@foo.net file1 | sendmail someone@somewhere.net

In each case the message subject is "test message", the message is sent from
me@foo.net, contains the attached file named "file1" and is sent to the email
address "someone@somewhere.net".
