class Mail::Message

def identify_and_set_transfer_encoding

def identify_and_set_transfer_encoding
  if body
    if body.multipart?
      self.content_transfer_encoding = @transport_encoding
    else
      self.content_transfer_encoding = body.negotiate_best_encoding(@transport_encoding, allowed_encodings).to_s
    end
  end
end