0
我使用outlook redemption dll用c#語言創建outlook消息模板。與嵌入式圖像展望贖回
下面是我的代碼:
RedemptionLoader.DllLocation64Bit = Server.MapPath("~/bin/dlls/Redemption64.dll");
RedemptionLoader.DllLocation32Bit = Server.MapPath("~/bin/dlls/Redemption.dll");
Interop.Redemption.RDOSession session = RedemptionLoader.new_RDOSession();
var msg = session.GetMessageFromMsgFile(templatePath);
msg.Subject = String.Format("Report");
String ImageString = Server.MapPath("~\\FolderName") + "\\" + ImageName;
RDOAttachment Attach = msg.Attachments.Add(ImageString);
Attach.ContentID = "image1";
String htb = "<html><head><title>The Title</title></head><body><h1>This is some text</h1>Image 1<br /><img src=cid:image1><br /></body></html>";
msg.HTMLBody = htb;
msg.Save();
msg.SaveAs(newPath);
一切工作和圖像保存到新的位置。但是,當我檢查消息模板時,我無法在任何地方看到圖像。它代替圖像給我錯誤。
更新 而是嵌入圖像的,我嘗試了附上這個文件。但是當我打開文件時,我沒有看到任何附件。我用OutlookSpy檢查總附件,它給我顯示了0個附件。我的代碼是否錯誤附件?
您是否使用OutlookSpy查看MSG文件(單擊OpenIMsgOnIStg)以檢查HTML是否正確,並且附件是否有正確的PR_ATTACH__CONTENTID值? –
我不熟悉outlookspy,請給我更多的細節? – Hiren
單擊OpenIMsgOnIStg - 您將看到IMessage窗口。檢查PR_HTML和PR_RTF_COMPRESSSED屬性。轉到GetAttachmentTabel選項卡 - 雙擊附件。 PR_ATTACH_CONTENTID屬性是否正確設置? –