【发布时间】:2012-02-01 00:52:12
【问题描述】:
我正在为 Outlook 2007 创建一个插件,我正在尝试将图像嵌入到新电子邮件中。我无法让图像嵌入工作,请帮忙。我的代码如下:
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Outlook.Inspectors inspectors;
inspectors = this.Application.Inspectors;
inspectors.NewInspector +=
new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
{
Outlook.MailItem mailItem = Inspector.CurrentItem as Outlook.MailItem;
if (mailItem != null)
{
if (mailItem.EntryID == null)
{
mailItem.Subject = "This text was added by using code";
mailItem.HTMLBody = "<html><body>this is a <img src=" + @"C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg> embedded picture.</body></html>";
//mailItem.HtmlBody = "<html><body>this is a <img src=\"cid:" + @"C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg" + "\"> embedded picture.</body></html>";
}
}
}
但这不显示图像。请帮忙。
提前致谢。
【问题讨论】:
-
这对你有用吗? [VSTO Outlook 嵌入图像邮件项][1] [1]:stackoverflow.com/questions/4196160/…
标签: c# outlook-addin outlook-2007