C# Office / Outlook 2010 工具栏 - HTML 电子邮件 - HTMLBody 速度很慢
我正在编写一个 Outlook 工具栏,它从网站下载一些电子邮件模板,然后允许从准备好的 html 文件创建 html 电子邮件,这是我用于创建电子邮件的代码:
MailItem letter = (MailItem)Globals.ThisAddIn.Application.CreateItem(OlItemType.olMailItem);
letter.HTMLBody = @"<div style=""text-align:center""> <b><br/>Please wait for content to be loaded...</b></div>";
letter.Display(false);
letter.BodyFormat = OlBodyFormat.olFormatHTML;
letter.HTMLBody = buffer.ToString();
这在 Outlook 2003/2007 中没问题,但在 2010 年却很慢。 我意识到 Outlook 在电子邮件中添加了很多蹩脚代码(MSO 样式、重新格式化 html 和许多其他废话),而且这实际上非常慢。我考虑过强制 Outlook 将垃圾代码添加到保存的 HTML 文件中,我已经尝试过:
// Compile the file and add the MSO Crap
MailItem letter = (MailItem)Globals.ThisAddIn.Application.CreateItem(OlItemType.olMailItem);
letter.BodyFormat = OlBodyFormat.olFormatHTML;
letter.HTMLBody = content;
content = letter.HTMLBody;
但是“content”变量仍然包含最初格式化的 HTML。这是正确的方向吗?如何使用 Outlook 代码重新格式化 HTML?
I'm programming an outlook toolbar that downloads some email templates from the website and then allows creating html emails from prepared html files, This is the code I use for creating an email:
MailItem letter = (MailItem)Globals.ThisAddIn.Application.CreateItem(OlItemType.olMailItem);
letter.HTMLBody = @"<div style=""text-align:center""> <b><br/>Please wait for content to be loaded...</b></div>";
letter.Display(false);
letter.BodyFormat = OlBodyFormat.olFormatHTML;
letter.HTMLBody = buffer.ToString();
This is OK in outlook 2003/2007 but so slow in 2010.
I've realized that outlook add lots of crappy code to the email (MSO styles, reformats html and lots of other crap), and this is actually very slow. I thought about forcing outlook to add the crap code to the saved HTML files, I've tried this:
// Compile the file and add the MSO Crap
MailItem letter = (MailItem)Globals.ThisAddIn.Application.CreateItem(OlItemType.olMailItem);
letter.BodyFormat = OlBodyFormat.olFormatHTML;
letter.HTMLBody = content;
content = letter.HTMLBody;
But the "content" variable still contains the originally formatted HTML. Is this the right direction? How can I get reformatted HTML with the outlook code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会回答我自己的问题...
I will answer my own question...