Adding #inline_content_id for attachments and parts
Remove the trailing =\n that pack('M') adds
Encode the whole string at once
Forgot that encode returns an array
Okay, pre-encoding the whole thing is not going to work
Alternative strategy: Just base64-encode everything
This hack didn't work.
- Only subtract prepend/6, since in order to get to the 10 character number, we're counting each character as potentially 6 characters in output.
- Remove leading horizontal whitespace before adding the remainder of @unfolded_line to @folded_line, since @unfolded_line will always end up starting with such a character, and otherwise it might be output double, if that part happens to be encoded-word-encoded
- My earlier hack which involved simply switching to base64-encoding didn't work, either, so this is removed.
- Ruby's pack("M") adds a trailing =\n to the string, which needs to be removed, otherwise we end up with an equal sign too many before the ending ?=, so it says =?= every time
- Fixed all the specs to reflect the changes
- Better to strip the white-space right away
- Added a test case to expose the problem I was seeing
We need to make sure we don't have two encoded-words next to each other on the same line, as the white-space between them is going to be eaten up.
Handle setting of charset through []= method, so we don't get the warning
Finally fixed the encoded-word encoding whitespace issues. This seems to nail it.
Make sure we can handle decoding of very long strings efficiently
Redid the folding to make it much much faster for long strings (the old one really crumbled with headers longer than 100,000 characters, which I happen to use in my setup with Sendgrid's SMTPAPI).

While I was at it, I decided to make it so that it would run longer stretches of encoded-words, and only one per line. The old implementation was really pessimistic in only taking at most 10 characters or up to the next white-space, encoding that (including all the overhead =?...?Q?...?=), and then repeating for the next 10-character stretch. This implementation tries to take as much as possible, given what it ends up looking like when it's encoded. The output is more compact and a lot prettier this way. Yay!

This version also fixes all the previous issues with extra white-space and an extra = at the end of the encoded-words.
Encode question marks in the encoded-word string
More encoding of special characters that are no-go in encoded-word-encoded strings.
Fixed performance issues with decoding values containing encoded-words... it scaled exponentially for long strings
Added recursive parsing of attachments inside message/rfc822 parts.
Allow bundler to automatically build a gem directly from git

Using bundler (now included with Rails 3.0), it's possible to fetch gems
directly from specific branches in a git repository.  This is very handy
for contributors and people who need to make small fixes.

With this patch applied, it's possible to include the following line
in a Gemfile:

  gem 'mail', :git => 'git://github.com/mikel/mail.git'

Then you can install the latest master branch using bundler:

  bundle install

This patch changes two things about the development process.  First,
gems are now built using:

  rake build

...or:

  gem build mail.gemspec

Second, the generated gemfile now appears in the top-level directory,
and not in a pkg/ subdirectory.
Use Mail::TestMailer.deliveries in README example