Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 带嵌入式图像的Outlook更新_C#_Outlook_Outlook Redemption - Fatal编程技术网

C# 带嵌入式图像的Outlook更新

C# 带嵌入式图像的Outlook更新,c#,outlook,outlook-redemption,C#,Outlook,Outlook Redemption,我使用outlook Redemption dll使用c语言创建outlook邮件模板 下面是我的代码: RedemptionLoader.DllLocation64Bit = Server.MapPath("~/bin/dlls/Redemption64.dll"); RedemptionLoader.DllLocation32Bit = Server.MapPath("~/bin/dlls/Redemption.dll"); Interop.Redemption.RDOSession se

我使用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);
        RedemptionLoader.DllLocation64Bit = Server.MapPath("~/bin/dlls/Redemption64.dll");
        RedemptionLoader.DllLocation32Bit = Server.MapPath("~/bin/dlls/Redemption.dll");


         Interop.Redemption.RDOSession session1 = RedemptionLoader.new_RDOSession();


        var msg1 = session1.GetMessageFromMsgFile(templatePath);


        msg1.Subject = String.Format("Report");

        String ImageString = Server.MapPath("~\\FolderName") + "\\" + ImageName;
        RDOAttachment Attach = msg1.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>";

        msg1.HTMLBody = htb;
        msg1.Save();

        Interop.Redemption.RDOSession session = RedemptionLoader.new_RDOSession();


        var msg = session.GetMessageFromMsgFile(templatePath);
        msg.SaveAs(newPath);
RedemptionLoader.DllLocation64Bit=Server.MapPath(“~/bin/dlls/Redemption64.dll”);
RedemptionLoader.DllLocation32Bit=Server.MapPath(“~/bin/dlls/Redemption.dll”);
Interop.Redemption.RDOSession session=RedemptionLoader.newrdosession();
var msg=session.GetMessageFromMsgFile(templatePath);
msg.Subject=String.Format(“报告”);
字符串ImageString=Server.MapPath(“~\\FolderName”)+“\\”+imagesname;
RDOAttachment Attach=msg.Attachments.Add(ImageString);
Attach.ContentID=“image1”;
String htb=“标题这是一些文本图像1

”; msg.HTMLBody=htb; msg.Save(); msg.SaveAs(newPath);
所有工作和图像都保存到新位置。但当我检查消息模板时,我在任何地方都看不到图像。它给我的不是图像,而是错误

更新
我没有嵌入图像,而是尝试附加此文件。但当我打开文件时,我没有看到任何附件。我用OutlookSpy检查全部附件,它显示0个附件。附件的代码是否有误?

我找到了解决方案。我需要打两次电话。第一次将附件保存到我的模板文件,然后再次创建它的新实例。下面是我的代码:

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);
        RedemptionLoader.DllLocation64Bit = Server.MapPath("~/bin/dlls/Redemption64.dll");
        RedemptionLoader.DllLocation32Bit = Server.MapPath("~/bin/dlls/Redemption.dll");


         Interop.Redemption.RDOSession session1 = RedemptionLoader.new_RDOSession();


        var msg1 = session1.GetMessageFromMsgFile(templatePath);


        msg1.Subject = String.Format("Report");

        String ImageString = Server.MapPath("~\\FolderName") + "\\" + ImageName;
        RDOAttachment Attach = msg1.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>";

        msg1.HTMLBody = htb;
        msg1.Save();

        Interop.Redemption.RDOSession session = RedemptionLoader.new_RDOSession();


        var msg = session.GetMessageFromMsgFile(templatePath);
        msg.SaveAs(newPath);
RedemptionLoader.DllLocation64Bit=Server.MapPath(“~/bin/dlls/Redemption64.dll”);
RedemptionLoader.DllLocation32Bit=Server.MapPath(“~/bin/dlls/Redemption.dll”);
Interop.Redemption.RDOSession session1=RedemptionLoader.new_RDOSession();
var msg1=session1.GetMessageFromMsgFile(templatePath);
msg1.Subject=String.Format(“报告”);
字符串ImageString=Server.MapPath(“~\\FolderName”)+“\\”+imagesname;
RDOAttachment Attach=msg1.Attachments.Add(ImageString);
Attach.ContentID=“image1”;
String htb=“标题这是一些文本图像1

”; msg1.HTMLBody=htb; msg1.Save(); Interop.Redemption.RDOSession session=RedemptionLoader.newrdosession(); var msg=session.GetMessageFromMsgFile(templatePath); msg.SaveAs(newPath);

这对我很有用。

你有没有用OutlookSpy查看MSG文件(单击OpenImsGoisting)来检查HTML是否正确,附件是否有正确的PR_ATTACH_CONTENTID值?我不熟悉OutlookSpy,你能给我更多详细信息吗?单击OpenImsGoisting-你会看到IMessage窗口。检查PR_HTML和PR_RTF_压缩属性。转到GetAttachmentTabel选项卡-双击附件。PR_attachment_CONTENTID属性设置是否正确?我检查此属性,在PR_RTF-COMPRESSED上,我可以看到带有cid:image1的img标记,但在GetAttachmentTable上,我看不到任何附件???屏幕截图的主题与代码中设置的主题不匹配。可能是你的实际代码与你在这里发布的代码有点不同吗?另外,考虑到Server.MapPath,您是否从web应用程序运行它?