From: CParticle Date: 2008-03-15T05:54:55+09:00 Subject: Help with IMAP and mime I'm trying to create a new mime message via imap but I'm having some problems getting the formatting down. I'm using net/imap and rmail to get and put data onto the imap server. I'd like to set the header correctly so that I can write the data to the server such that it understand what it is. In this case a calendar item. The idea being that I could then write a calendar item directly to my calendar on my exchange server and exchange would treat it as such. ---Begin Code----- require 'net/imap' require 'rubygems' require 'rmail' imap = Net::IMAP.new('myserver') imap.login('username', 'password') imap.select('Calendar-folder') myAppt = RMail::Message.new myAppt.header.date = Time.now myAppt.header.from = 'myemail@myserver.org' myAppt.header.to = 'myemail@myserver.org' myAppt.header.subject = 'Ruby test appointment' myAppt.header.add('Content-Type', 'MULTIPART/ALTERNATIVE') part = RMail::Message.new part.header.add('Content-Type', 'TEXT/CALENDAR', nil, 'param' => '{"METHOD" => "REQUEST"}') part.header.add('Content-class', 'urn:content-classes:appointment') part.body = vCard myAppt.add_part(part) imap.append("Calendar-folder", RMail::Serialize.write('', myAppt), [:Seen]) ---End Code----- I'm particularly concerned with how to get the param set properly. ---------------------------------------------- I pulled some data from the server using imap.fetch(message_id, "BODY") This is what I would like to get the header to look like ##"REQUEST"}, content_id=nil, description=nil, encoding="8BIT", size=1279, lines=22, md5=nil, disposition=nil, language=nil, extension=nil>], param=nil, disposition=nil, language=nil, extension=nil>}> --------------------------------------------- This is what I'm managing to create #[:Seen], "BODY"=>#"{"}, content_id=nil, description=nil, encoding="7BIT", size=1761, lines=30, md5=nil, disposition=nil, language=nil, extension=nil>], param=nil, disposition=nil, language=nil, extension=nil>}> Thanks for any help you can give. CParticle