Powered By BlogNow - Get Your Free Blog

I have moved!

My new blog is at lindsaar.net

All the old content will stay here though. But check out the new blog

¿ 22/10/2007 - Fix for TMail to handle MS Outlook MIME Emails

I ran into this bug yesterday.

I use the TMail library, it handles email very well.  However, MS outlook express sets the Content-Type boundary= value to an illegal value.  Per RFC 2045 you can't have ? or / or = in the boundary text field.  MS Outlook uses "=" which then breaks TMail trying to read it.

What then happens is when you do a tmail_object.to_s it does not include the content-type field and your email looks like really bad plain text with the MIME parts treated as plain text, not MIME parts.

Per the RFC, if you want to use these illegal characters, you need to quote the field.

So this fix just puts in a "clean_bad_boundary" method to add quote marks around any boundary field that contains illegal characters.  Simple and it works quickly.

You can download the file from here: TMail Patch.

It is a diff file which changes two files in the TMail 0.10.8 branch (the testheader file and the header file) and includes failing tests which then pass when you apply the diff to header.rb.

Enjoy.

blogLater

Mikel
Post A Comment! :: Send to a Friend!

About Me

AKA Raasdnil, this site is about web coding, hosting and all other matters that relate to this... especially Ruby on Rails!

Links