Get Involved m2f
connecting communities
m2f @ SourceForge.net  

MIME Handling (Mail attachments)

March 7th, 2009 by Pda0

We’ve been testing current MIME handling functionality for a while now, and I must say it’s working quite well! But… what the hell is MIME? Read on (Screenshots available!).

After the initial importing of a message, m2f analyzes the message content in order to understand its structure. If the message is being imported from an email channel, that means looking the current format of the message (ie. html, plain text and so on), checking if the email has attachments (normal attachments or inline attachments), etc. The way that emails handle multiple formats and attachments is called MIME Handling. As quoted from wikipedia:

Multipurpose Internet Mail Extensions (MIME) is an Internet standard that extends the format of e-mail to support:

  • Text in character sets other than ASCII
  • Non-text attachments
  • Message bodies with multiple parts
  • Header information in non-ASCII character sets

Yes… daily life email messages are more complex than you could think! A typical email could have several parts, including a plain-text AND html-version of the message, inline images, file attachments and so on. m2f goes through all the parts and cleverly guesses which parts should be used for the message conversion process, which should be stored for later use, and which we’ll actually discard as message scrap.

m2f is being designed to alter the original message as well, which is an important matter for security’s and flexibility’s sake. For example, it will be able to sanitize html messages in order to try and filter out common code-inyection vulnerabilities (such as Cross Site Scripting). This will be configurable in the future.

Right now m2f mainly passes html as-is to the export channel, but first it strips all attachments and stores them in the m2f attachments directory. It then adds a link to every attachment at the bottom of the message, that points to the attachment that was stripped. This might be early attachment management, but it is working very well! Check this out:

Original Outlook Email

Original Outlook Email

m2f Processed Email

m2f Processed Email

Did you notice the “scrubbed attachment” on the Processed Email? Of course this is bare-bones implementation, there is still a lot to do, but the most difficult part (MIME Handling!) is almost over. The screenshots above are a result of a “mbox->filewriter” chain configured with current SVN :)

.pd

Share this post:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Slashdot

Posted in Blog

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.