outlook-redemption - 如何使用具有 HTML 正文的 Redemption C# 创建 Outlook .msg 文件?
问题描述
创建 HTML 格式的 .msg 文件时,我似乎无法获得任何格式。文本显示在正文中,但未应用 HTML 格式。有什么建议么?
RDOSession rdoSession = new RDOSession();
rdoSession.Logon();
// Start with a seed.msg
File.Copy(@".\seed.msg", @".\test.msg", true);
RDOMail rdoMail = rdoSession.GetMessageFromMsgFile(@".\test.msg", false);
// Set body format to HTML
rdoMail.BodyFormat = 2;
rdoMail.Subject = "HTML format test";
rdoMail.HTMLBody = "<html><body><b>bold</b> text</body></html>";
// PR_InetMailOverrideFormat
rdoMail.set_Fields(0x59020003, 0x00020000 | 0x00100000 | 0x00040000);
// PR_MSG_EDITOR_FORMAT
rdoMail.set_Fields(0x59090003, 2);
rdoMail.Save();
解决方案
看起来您正在打开一个现有的 MSG 文件。我对从 OutlookSpy 执行的以下脚本没有任何问题(单击 OutlookSpy 工具栏上的“脚本编辑器”按钮,粘贴脚本,单击运行):
set Session = CreateObject("Redemption.RDOSession")
set rdoMail = Session.CreateMessageFromMsgFile("c:\temp\html.msg")
rdoMail.Subject = "HTML format test"
rdoMail.HTMLBody = "<html><body><b>bold</b> text</body></html>"
rdoMail.Save
推荐阅读
- javascript - 如何调用异步 JavaScript 函数?
- mysql - 单表父子关系查询
- python - Python Pandas Period Date 差异在 * MonthEnds>, NaT, 如何将其转换为 INT 值
- javascript - EntityMetadataNotFound:找不到“任务”的元数据 - NestJS
- azure - “执行输出的长度超出限制”ADF Web 活动中的错误
- mysql - 数据库服务器、分区和实例
- android - 如何在kotlin中初始化动画矢量
- python - 根据多行条件比较两个不同的数据帧
- python - 如何将 TensorFlow 训练数据导出为 CSV
- execute - 简单 wxpython 执行示例中的错误