class Mail::Message

def self.from_yaml(str)

def self.from_yaml(str)
  hash = Mail::YAML.load(str)
  m = self.new(:headers => hash['headers'])
  hash.delete('headers')
  hash.each do |k,v|
    case
    when k == 'delivery_handler'
      begin
        m.delivery_handler = Object.const_get(v) unless Utilities.blank?(v)
      rescue NameError
      end
    when k == 'transport_encoding'
      m.transport_encoding(v)
    when k == 'multipart_body'
      v.map {|part| m.add_part Mail::Part.from_yaml(part) }
    when k =~ /^@/
      m.instance_variable_set(k.to_sym, v)
    end
  end
  m
end