When sending an email with JavaMail, how do I save...
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   guan_ho
Posted On:   Monday, November 27, 2000 09:55 PM

When sending an email with JavaMail, how do I save a copy of it in my MS Exchange "Sent Items" folder?
Initialy, I tried to append the message to the folder before sending it out, but the problem is that when there is an attachment, the attachment appears in the folder as text.

Re: When sending an email with JavaMail, how do I save...

Posted By:   Dieter_Wimberger  
Posted On:   Sunday, August 12, 2001 08:17 AM

Alternatively you can send the message first, and then append it normally. The only problem I encountered is that the send date is not set properly. So I use following after sending the mail:


[...]
//Set the sent date
message.setSentDate(new Date());
//get the folder (just example, I use a method)
Folder archive=getSentMailFolder();
//open it read write
archive.open(Folder.READ_WRITE);
//save the message in archive, by append (I think it needs to be an array)
Message[] tosave={message};
//append it
archive.appendMessages(tosave);
//I close without expunging
archive.close(false);
[...]

Re: When sending an email with JavaMail, how do I save...

Posted By:   guan_ho  
Posted On:   Monday, March 26, 2001 10:12 PM

call saveChanges() first before u append.
About | Sitemap | Contact