有没有办法改变一个域的数据类型?

kelvin-w 2005-07-12 05:28:05
比如:

--------
域名: Body
数据类型: RTF 文本
--------

改成:

--------
域名: Body
数据类型: MIME 部分
--------

有没有办法???
原因是new 一个NotesRichTextItem可以new多次,但是CreateMIMEEntity("bady")只能create一次,而我想实现能create多个mimeEntiry,所以想先create多个NotesRichTextItem再转换成MIME
...全文
253 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
maplescloud 2005-07-14
  • 打赏
  • 举报
回复
This example creates a multi-part MIME entity, setting header values as necessary.
import lotus.domino.*;

public class JavaAgent extends AgentBase {

public void NotesMain() {

try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();

// (Your code goes here)
Stream stream = session.createStream();
// Do not convert MIME to rich text
session.setConvertMIME(false);
Database db = agentContext.getCurrentDatabase();
Document doc = db.createDocument();
// Create parent entity
doc.replaceItemValue("Form", "Memo");
MIMEEntity body = doc.createMIMEEntity();
MIMEHeader header = body.createHeader("Content-Type");
header.setHeaderVal("multipart/mixed");
header = body.createHeader("Subject");
header.setHeaderVal("MIME message");
header = body.createHeader("To");
header.setHeaderVal("Roberta Person");
// Create first child entity
MIMEEntity child = body.createChildEntity();
stream.writeText("Text of message for child 1.\n");
child.setContentFromText(stream, "text/plain", MIMEEntity.ENC_NONE);
stream.truncate();
// Create second child entity
child = body.createChildEntity();
stream.writeText("Text of message for child 2.");
child.setContentFromText(stream, "text/plain", MIMEEntity.ENC_NONE);
doc.send(false);
// Restore conversion
session.setConvertMIME(true);

} catch(Exception e) {
e.printStackTrace();
}
}
}
maplescloud 2005-07-14
  • 打赏
  • 举报
回复
NotesMIMEEntity下有一个方法CreateChildEntity,由此来创建多个MIMEEntity,详细可查帮助。
BTW:CreateMIMEEntity("bady")是用来创建TOP-LEVEL的MIME entity
kelvin-w 2005-07-14
  • 打赏
  • 举报
回复
http://dev.csdn.net/article/16/16534.shtm
楼上的你可以看看上面的参考
kelvin-w 2005-07-14
  • 打赏
  • 举报
回复
非常感谢,我今天也试着这样去做了,发送html邮件是没有问题。
问题是附件怎么办?难道我还要把附件拆离到harddisk上,然后对其编码?
试了一下,好像行不通啊
maplescloud 2005-07-13
  • 打赏
  • 举报
回复
一个文档作为邮件发送的时候只需要一个MIMEEntity,你想在同一个文档里面create多个的目的何在?如果确实想产生多个,就用多个文档去create。
hanwenjuan3 2005-07-13
  • 打赏
  • 举报
回复
关注!
dfbbygao 2005-07-13
  • 打赏
  • 举报
回复
你做出来的邮箱怎么实现发html内容的?
kelvin-w 2005-07-13
  • 打赏
  • 举报
回复
发现用inotes发送HTML邮件的时候,它会创建多个body,每个都是MIMEEntity;
我想用标准的邮件模板去改造,模仿inotes的这种方式去发html邮件,否则,我做出来的邮箱能发送html的内容,但附件却总会丢失,所以想解决这个问题
kelvin-w 2005-07-12
  • 打赏
  • 举报
回复
主要用来发送html邮件用,那位有做过这个玩意?
深圳陈建军 2005-07-12
  • 打赏
  • 举报
回复
我对BS开发不熟,请教您使用MIME有什么作用啊?
不过我从帮助里看到RTF域的数据类型只能通过“Type”属性进行改变,并且没有改成Mime部分的类型。

535

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 Exchange Server
社区管理员
  • 消息协作社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧