[Domino]Java访问Domino邮件代码片断[3]

博客介绍Java访问Domino邮件时转发用户收件箱中某封邮件的代码要点。需通过noteID定位邮件,用createDocument方法创建新文档并复制原邮件字段,用replaceItemValue替换部分字段数值,此方式会一并转发附件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

[Domino]Java访问Domino邮件代码片断[3]

编写者<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

日期

关键词

郑昀@ultrapower

2005-7-1

Java Domino

 

转发用户收件箱中的某一封邮件

3个知识点:

1:需要通过noteID来定位该邮件:

Database dbMail = sNotes.getDatabase(sNotes.getServerName(),

                      mailfile, false);

Document doc = dbMail.getDocumentByID(noteid);

2:通过DocumentcreateDocument方法创建一个新文档,然后通过DocumentcopyAllItems方法将原邮件的所有字段复制过来

3:通过replaceItemValue方法将部分字段的数值替换。

代码片段:

Database dbMail = sNotes.getDatabase(sNotes.getServerName(),

                      mailfile, false);

Document doc = dbMail.getDocumentByID(noteid);

if (doc != null)

{

                       Document forward = dbMail.createDocument();

                       // Given a destination document, copies all of the items in

                       // the current document into the destination document.

                       // The item names are unchanged.

                       // 2个参数解释如下:

                       // replace

                       // Boolean. If True, the items in the destination

                       // document are replaced. If False (default),

                       // the items in the destination document are appended.

                       doc.copyAllItems(forward, true);

                       Item itemSubject = doc.getFirstItem("Subject");

                          String strItemRe = "转发:" + itemSubject.getText();

 

                          forward.replaceItemValue("Subject",

                                        strItemRe);

                          forward.replaceItemValue("Recipients", to);

                          forward.replaceItemValue("SendTo", to);

                          forward.setSaveMessageOnSend(true);

                          forward.send(to);

}

这种转发方式,会将原邮件的附件一并转发。

 

 

编写者

日期

关键词

郑昀@ultrapower

2005-7-1

Java Domino

 

转载于:https://www.cnblogs.com/zhengyun_ustc/archive/2005/07/01/184629.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值