Edit msg files with ruby

Hi, I try to customize many msg files. I wan’t convert them with an
application. but there’s the problem many of the mails have a
unconvential message class the application can’t handle. I wan’t set the
default message class for all msg files. With ‘ruby-msg’ I can read all
properties like that:

require ‘mapi/msg’
msg=Mapi::Msg.open(‘C:\Users***.MSG’)
h=Hash[t.keys.zip(t.values)]
h.each_key do |k|
puts “#{k.to_s}:\t#{h[k].to_s}”
end

That works! But I found no way to write to change mail properties like
here.

require ‘mapi/msg’
msg=Mapi::Msg.open(‘C:\Users***.MSG’)
msg=msg.properties.raw.add_property(‘message_class’,‘IPM.Note’)
f=File.open(‘C:\Users**.MSG’,‘w’)
f.write(msg)

That doesn’t work. Is somebody knowing a way to accomplish this? All
possible solutions are welcome:)!