[KLUG Members] MIME attachments

Robert G. Brown bob at whizdomsoft.com
Wed Nov 16 14:33:56 EST 2005


Fellow KLUGites and developers, 
I want to generate some email that will have one or more attachments, so I want to 
understand MIME very clearly. So far, here's what I do....

I add these lines to the header:

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="-d-i-v-i-d-i-n-g--l-i-n-e"

And the body of the message looks like...
--------------------------------------------
You will only see this if you're using a non-MIME supporting Client!!

-d-i-v-i-d-i-n-g--l-i-n-e
Content-Type: text/html;

<html>
  <head>
  ....
</html>

-d-i-v-i-d-i-n-g--l-i-n-e

----------------------------------------------

More attachments work pretty much the same way. I have derived the above by
inspecting a number of MIMEd mail messages as plain text files, and I'm omitting
some detail

Seems simple enough for EVERYONE'S favorite, HTML Mail! :)

It is a simple example, and the main app generates HTML-based reports
(PDF, when I get done with it).


Anyway, I send the message, and it all looks well on recipt... UNTIL
I try to read the attachment! This is why the above example is not more 
complex; if It doesn't work, then I have missed something that would 
probably be true for a more complex example, but something more complex
would introduce other factors.... maybe...

In any case, I get an amusing set of errors, the wording varies with the mail
application I happen to be using....

Outlook 97:
  
An error prevented processing the message to completion. The original
message is contained in the attached file MESSAGE.TXT

	Which does NOT display as HTML.

mhstore: bogus multipart content in message xxxx

Really helpful...

I could try more clients, but I suspect I will only increase my collection
of somewhat useless but mildly amusing error messages.

I don't want to build something based on a pile of libraries, as I'm trying
to keep this thing reasonably portable and compact. I am thinking that we 
can build MIME'd  messages for special cases rather easily....

I've also looked for more detailed information about all this, but found very
little. Perhaps it is swamped by all the references to various MIME-capable
applications...

I lok forward to your replies...
							Regards,
							---> RGB <---



More information about the Members mailing list