MIME Types 101 (was Re: [TriLUG] how to list users connected to
william at trilug.org
Mon Feb 23 13:04:59 EST 2004
I had some idea of what mime-types are before asking the question...just
didn't figure that something with text in it even with a .pl extension
would get attached as something other than text or html.
In any case, the full explanation is probably good since doubtless there
was at least one other person wondering the same thing and didn't ask:
Everything you ever wanted to know about mimes but were afraid to gesture
just kidding of course...thanks for the explanation :)
On Mon, 23 Feb 2004, Tanner Lovelace wrote:
> William Sutton said the following on 2/23/04 1:47 AM:
> > Mind explaining why a script (which is basically a text attachment) gets
> > filtered out as NOT being a text attachment? Seems peculiar to me....
> > William
> It all has to do with MIME types (The Robot, The Wall, Walking Your Dog
> ... um, no wait, wrong Mime! ;-)
> MIME = "Multipupose Internet Mail Extensions. A set of extensions to
> SMTP designed for transmitting nontext e-mail message attachments."
> Basically, when you attach something to your mail message, the MIME
> type is a hint of what kind of file it is. It always consists of
> two categories, the first one more general than the second.
> Common types include "text/plain", "text/html", "application/pgp"
> "application/exe", etc... There are a ton of different mime types.
> (Google for them if you're interested.).
> What I believe happened is that when chris attached a perl script
> to his message, his mail program looked at it and said something like,
> "Hmm... it's got a .pl extension. I bet that's a perl script! Ok,
> I'll set the mime type to something like application/perl or
> application/script." Whatever it did, it almost certainly didn't
> set it to "text/plain" because otherwise it should have made it to
> the list.
> As to why it chose something other than text/plain, well, how is
> the mail program supposed to know it's text plain? You could
> try renaming the script something like perlscript.pl.txt and see
> if that fools it into thinking it's a text file, but in the
> abscense of that it has to do the best it can about guessing.
> It's not an exact science.
> Note, btw, that MIME types, although they came about for mail,
> are now used a lot of other places too. Have you ever seen
> a website where it displays the raw html text instead of the
> rendered web page? That's because the web server said the
> file being sent to the web browser was text/plain instead of
> text/html. Or if your web browser tries to save a PHP file
> instead of display it, it's probably setting the mime type
> to application/php.
> So, how does this relate to why it was filtered out on the
> trilug list? Basically, because of how recent viruses act,
> we've been basically forced to turn on content filtering
> in mailman for the trilug list to ensure that we're not
> a delivery mechanism for viruses. Since most viruses
> send executables, which actually have correct mime types
> (they have to or otherwise Outlook, etc, won't execute them),
> we filter on mime type. But, rather than make the list
> too small, since the number of legitimate mime types that
> can be sent to the list is small, we actually specify a list
> of mime types that are ok for the list. That list is this:
> If a message comes in with a section that has any other
> mime type, mailman will remove that section of the message.
> If the message is blank after it does that, it will discard
> it, otherwise it will hand it off to normal processing.
> What happened in Chris's case was that his message had
> several sections: a text/plain section that was the
> message itself, an application/pgp-signature section,
> and a type that was probably something like
> application/script. Mailman removed the application/script
> part and sent the message on. (Actually, it's a bit more
> complicated even than that, but that's a good high
> level view.)
> As a side note this will also do things like remove images
> from messages too.
> So, William, does that answer your question? I wasn't
> sure how much you knew about mime types, so if I tailored
> my message at a lower level than you were expecting, I
> apologize. But, that's basically what happened.
More information about the TriLUG