morleymouse,
MIME is pretty hardcore stuff mind you...
The tutorial above uses the MIME class that comes with PAIR, same class in theory

.
But, if you do want to write your own MIME class

here is the MIME RFC (2045),
http://www.faqs.org/rfcs/rfc2045.html happy reading
