Attaching files using Java

Hi,

I have been having some trouble trying to figure out how to attach a word document to a Lotus Notes email using Java. I have had a look through this forum and over Google but all I can find is help for VB, so I apologise if this has already been answered elsewhere.

I can get my Java program to create a new email and save it in the draft folder, but I would like it to attach a word document too.

I have tried the following:

mailDoc.createRichTextItem(“R:\Test.doc”);

Any help would be greatly appreciated and I thank you in advance.

Steve

Subject: Attaching files using Java

please check thee Designer help there are perfectly working e.gs

Subject: Attaching files using Java

The answer is to create a richtext item and embed the file as an attachment:Document mail_doc = db.createDocument();

mail_doc.replaceItemValue(“Subject”, “Enclosed file”);

mail_doc.replaceItemValue(“SendTo”, “some_user@example.com”);

RichTextItem rt = mail_doc.createRichTextItem(“Body”);

rt.embedObject(1454, “”, “c:\somefile.doc”);

mail_doc.send(false);

/Mikkel Heisterberg

Visit my blog @ http://lekkimworld.com

for posts on Notes/Domino, Sametime 7.5 development and how to use Java in Notes/Domino…