Tests and fixes for TMail -> Mail for mail parsing and Ruby 1.9 compatability

These commits include some extra tests for mail handling cases that seemed to differ between the old TMail-based mail backend and the newer Mail-based version.  It also introduces fixes for those problems, with the exception of a couple of rare cases with unusual MIME boundary structure, which I've marked as pending. In addition, there are a number of fixes for Ruby 1.9 compatibility.

I suggest this isn't merged until I've re-run the mail parsing over a larger corpus, but it could be reviewed now in any case.