Reputation: 43
I download mail by POP3 use JavaCode after that I save document mail:
Document doc = db.createDocument();
MIMEEntity body = doc.createMIMEEntity("Body");
MIMEHeader header;
for (String key : messages.get(index).getHeaders().keySet()) {
header = body.createHeader(key);
header.setHeaderVal(messages.get(index).getHeaders().get(key).get(0));
}
if (messages.get(index).getBody().length() > 0) {
if (body.getContentType().equals("multipart")) {
// Create first child MIMEEntity
MIMEEntity child = body.createChildEntity();
stream.writeText(messages.get(index).getBody());
child.setContentFromText(stream, "", body.getEncoding());
} else {
stream.writeText(messages.get(index).getBody());
body.setContentFromText(stream, messages.get(index).getHeaders().get("Content-Type").get(0),
body.getEncoding());
}
}
stream.close();
doc.replaceItemValue("Form", "Mail");
doc.save(true, true);
doc.closeMIMEEntities(true);
Convert MIME to RichText Same problem "I can do this conversion with a notes client in frontend (open and save the document) without any problems." If I open and save doc on client, mime fields for CKEditor look same as on client. Fields body not converted to RichText and it is working good for CKEditor.
I was try to do this by add code:
session.setConvertMime(true);
RichTextItem rtitem = (RichTextItem)doc.getFirstItem("Body");
if (rtitem!=null) {
rtitem.compact();
doc.save();
}
And this :
doc.convertToMIME(3);
doc.save(true, true);
Result is not the same like after save on Notes Client.
Thanks for any help!
Upvotes: 0
Views: 128
Reputation: 14628
IBM/Lotus has two very different MIME conversion routines. Neither of them provides perfect fidelity. If you want consistent results with high-fidelity conversions, there is a 3rd-party company called Genii Software that provides software that does what you need. It is not free, but it can save you a ton of work.
Upvotes: 1