Backport Mail 2.5's to_yaml to prevent an exception with Ruby 1.8