0

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!

  • If to compare some date fields : before save on client "Field Name: PostedDate Data Type: RFC822 Text" after "Field Name: PostedDate Data Type: Time/Date" – user3905270 Mar 24 '20 at 10:34
  • in document before save on client : 4 body fields "Field Name: Body Data Type: MIME Part" after save on client I have different 9 body fields – user3905270 Mar 24 '20 at 10:40
  • before save attachment in web looks like : PrintPriceListByCategories2Excel.xls"; size=884224;creation-date="Fri, 20 Mar 2020 03:09:03 GMT";modification-date="Fri, 20 Mar 2020 03:09:15 GMT after save in client: 863 KB PrintPriceListByCategories2Excel.xls 24.03.20, 18:22 – user3905270 Mar 24 '20 at 12:37

1 Answers1

1

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.

Richard Schwartz
  • 14,463
  • 2
  • 23
  • 41
  • 1
    Thanks for free advertising! ;) But It's not gods who make pots. – user3905270 Mar 24 '20 at 17:09
  • As one of MIT + node.js way: https://github.com/nodemailer/mailparser/blob/master/README.md – user3905270 Mar 25 '20 at 06:08
  • As varant convert mime to html and save to RichText field use JavaMail but is JavaEE: https://stackoverflow.com/questions/11240368/how-to-read-text-inside-body-of-mail-using-javax-mail – user3905270 Mar 25 '20 at 07:05