message.SetSubject(new JIString("Test JXCdoMessage").Variant);
message.SetText(new JIString("This is a test message sent from a Java program through j-XChange.").Variant);
// set message recipients
JXCdoRecipients recipients = new JXCdoRecipients(jxCdoSession,message.GetRecipients());
JXCdoRecipient r1 = new JXCdoRecipient(jxCdoSession,recipients.Add(JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM()));
JXCdoRecipient r2 = new JXCdoRecipient(jxCdoSession,recipients.Add(JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM()));
// set recipients' addresses
r1.SetName(new JIString("dont@spam.com").Variant);
r2.SetName(new JIString("dont@spam2.com").Variant);
// r1 will be the 'to' address and r2 will be 'cc'-ied
r1.SetType(new JIVariant(JXCdoEnum.CdoRecipientType.CdoTo.intValue()));
r2.SetType(new JIVariant(JXCdoEnum.CdoRecipientType.CdoCc.intValue()));
// Each recipient added must be resolved before it can be used.
// 0 == false to inhibit dialog boxes from popping up
r1.Resolve(new JIVariant(0));
r2.Resolve(new JIVariant(0));
// set the attachment
// Attachments attachments = new AttachmentsProxy(message.getAttachments());
// Attachment attachment = new AttachmentProxy(attachments.add(null, null, null, null));
// attachment.setSource("c:\\temp\\attach.doc");