谁能告诉我如何处理莲花笔记中的嵌入式图像 [英] can anyone please tell how to deal with inline images in lotus notes

查看:91
本文介绍了谁能告诉我如何处理莲花笔记中的嵌入式图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在通过Java发送带有Lotus Notes的电子邮件.我能够发送电子邮件.对于外部附件,我正在构建一个富文本项.但是我没有得到如何处理内联附件的信息,例如邮件正文部分中的图像. 这是我正在使用的代码.谢谢

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();
}

推荐答案

NotesRichTextItem类的功能非常有限. Genii Software公司提供了一个名为MIDAS的第三方API,该API功能强大得多,可以为您提供所需的功能,但是它是商业软件,通常在LotusScript中使用.我什至不确定Genii是否支持Java.

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.

也就是说,另一种方法是使用NotesMIMEEntity类而不是NotesRichTextItem.要在MIME中内嵌图像,您需要创建一个multipart/mixed实体,其中包含一个multipart/related实体,其中包含text/html和image/gif(例如,如果您是图像的类型)实体,其中该图像实体具有内容处置:嵌入式; filename = xxx,并且text/html正文中的标记将使用"src = cid:xxx"格式来引用图像实体.

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.

这篇关于谁能告诉我如何处理莲花笔记中的嵌入式图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆