Problems whit the set's (Strings)

Hi im used the MapiMessage, i have in an message object whit the content of a body mail, and when i try to save the body message in the attribute mapiMessageFile.setBody(part.getContent().toString()) i have a problem... it work whit a string "something", but not if you pass an object String like i do....; when i open the msg file i can see the error: ASE64DecoderStream, i attach an imagen where you can see the problem.

Thanks.

Guillermo


This message was posted using Page2Forum (attachment) from Creating Outlook Message Files from Scratch - Aspose.Network for Java

Hi Guillermo,


Thanks for considering Aspose.

MapiMessage.setBody() method requires a String type argument, for setting the text body. Could you please share some more code sample how you are setting the body?

If you already have a message loaded, you may set as follows:

try
{
String msgFileLoad = “e:\folder\Existing.msg”;
String msgFileNew = “e:\folder\New.msg”;
MapiMessage messageLoad = MapiMessage.fromFile(msgFileLoad);

MapiMessage messageNew = new MapiMessage();
messageNew.setSenderEmailAddress("from@domain.com");
messageNew.getRecipients().add((MapiRecipient)new MapiRecipient(0, MapiRecipientType.MAPI_TO, "to@domain.com", “SMTP”));
messageNew.setBody(messageLoad.getBody());
messageNew.save(msgFileNew);
System.out.println(“Saved the new message.”);
}
catch(Exception ex)
{
System.out.println("Error: " + ex.getMessage());
}