can anyone please tell how to deal with inline images in lotus notes

梦想的初衷 提交于 2019-12-24 02:12:25

问题


Hi guys i am working on sending an email in lotus notes through java.I am able to send an email.For external attachments i am constructing an rich text item.but i am not getting how to deal with inline attachments such as an image inside a mail body part. Here is the code i am using.thanks

                Document doc = null; 
            RichTextItem rti = null;
            try{
                doc = db.createDocument();
                doc.replaceItemValue(ServiceConstants.FROM,getFrom() );
                doc.replaceItemValue(ServiceConstants.FORM, getForm());
                doc.replaceItemValue(ServiceConstants.SUBJECT, getSubject());
                doc.replaceItemValue(ServiceConstants.SENDTO,asVector(getSendTo()));
                doc.replaceItemValue(ServiceConstants.COPYTO,asVector(getCopyTo()));
                doc.replaceItemValue("Principal",getFrom());
    rti = doc.createRichTextItem(ServiceConstants.BODY);
                rti.appendText(getBody());
                if ((getAttachment() != null) && (getAttachment().length > 0)) {
                    for (int i=0; i<getAttachment().length; i++)    {
                        getAttachment()[i].save(rti);
                    }
                }   
                doc.save();
                if (send) {
                    doc.send();
}

回答1:


The capabilities of the NotesRichTextItem class are fairly limited. There is a 3rd party API called MIDAS from a company called Genii Software that is considerably more powerful and may give you the capabilities that you want, however it is commercial software and it is generally used from LotusScript. I'm not even sure if Genii supports it in Java.

That said, the other approach is to use the NotesMIMEEntity class instead of the NotesRichTextItem. To do in-line images in MIME, you will need to create a multipart/mixed entity containing a multipart/related entity containing text/html and image/gif (for example, if that's the type of your images) entities, where the image entities have Content-disposition: Embedded; filename=xxx and the tags within the text/html body would use the "src=cid:xxx" format to refer to the image entities.



来源:https://stackoverflow.com/questions/21280172/can-anyone-please-tell-how-to-deal-with-inline-images-in-lotus-notes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!