[Mailman-Developers] Headers and footers for MIME messages

Andrew McNamara andrewm@connect.com.au
Fri, 30 Mar 2001 12:20:05 +1000


>3. A message comes in that has some other main Content-Type than
>   "multipart", e.g. image/gif.  This is a little tricker, but what I
>   think you can do is transform the container message into a
>   multipart/mixed, add the header and footers as subparts, and create
>   a new subpart for the original message payload.  You'd need to copy
>   the body of the original message, plus any Content-* headers, into
>   the subpart, but I think you leave all other headers in the
>   container alone.

I'd consider it slight offensive to send random binary objects to a
mailing list without any lead-in text/plain explanation, but I can
imagine a special purpose list that would want to do this (but would
they want headers and footers attached?).

A straight text/html message is probably the most common problem case -
the swiss-army-knife of list software would probably have the header
and footer as html, and convert to text/plain when necessary (yuk).

There are another of other options people will ask for: convert
text/html to text/plain, bounce text/html back to sender, etc.

You may think this is well outside the scope of what you were intending
to implement, but the worm-can has been opened by adding mime support
and people won't let you rest until your software makes
breakfast in bed for them.

You'll soon end up with a complex language for specifying things like
"accept binary attachments only if preceeded by a text/plain", etc.. 8-)

BTW, I think there's a special mime type for headers and footers -
text/plain isn't the right one. Can't remember off the top of my head.

>4. A message comes in that is multipart/* but not multipart/mixed.
>   What to do here?  I suppose we could play the same trick as
>   #3, but it seems like an awful lot of work and potentially error
>   prone.  Maybe not though.  Alternatively, we could add the header
>   and footer to any existing preamble and epilogue, although they'll
>   get hidden by most MIME-aware MUAs.

The big one being multipart/alternative, of course, which typically
contains a text/plain and a text/html.

The safest rules would be:

- if it's not a mime message, do the old thing.
- if it's mime, and it's not already a multipart/mixed, create a 
  text/multipart with header/original mime/footer.
- it it's mime, and and multipart/mixed, simply insert and append
  the header and footer parts.

Messing with the text/plain part is vaguely attractive, although
conceivably it could break things (smime? dunno).

 ---
Andrew McNamara (System Architect)

connect.com.au Pty Ltd
Lvl 3, 213 Miller St, North Sydney, NSW 2060, Australia
Phone: +61 2 9409 2117, Fax: +61 2 9409 2111