setting email headers so gmail formats email correctly

      @body['sender'] = sender

I doubt that is going to work like you want it to. "Sender:" is a
fairly magical header that's used by MTAs to let MUAs know which
envelope sender was used, so depending on the exact details of your
mail setup that line may work as you intend, be deceptive or be
overwritten.

For my own application, I wrote a tiny plugin that monkeypatches
ActionMailer to allow setting the sender as it should be (in the SMTP
dialog for :smtp, with -f for :sendmail). I don't have a public svn
server to easily publish it from, but I could post it here, I guess.
If there's interest.

Duh. Of course. I blame lack of caffeine.

Anyway, if anyone is interested in the plugin to set the real sender,
it's on http://rubyforge.org/projects/amsenderplugin/ now.

Rails Recipes has a recipe for exactly this case. Here's a snippet
that can help you along the way:

def multipart_alternative(recipient, name, sent_at = Time.now)
  ...
  content_type "multipart/alternative"
  part :content_type => "text/plain",
    :body => render_message("multipart_alternative_plain", :name =>
name)

  part :content_type => "text/html",
    :body => render_message("multipart_alternative", :name => name)
end

It's all in the anonymous SVN repo for the project:
svn://rubyforge.org/var/svn/amsenderplugin