简体   繁体   English

Outlook电子邮件将不会显示在Web应用程序中

[英]Outlook Email won't display in web application

I have a web application with some functionality to allow a user to send an email using Microsoft.Office.Interop.Outlook.Application. 我有一个具有某些功能的Web应用程序,允许用户使用Microsoft.Office.Interop.Outlook.Application发送电子邮件。 I want to display the email to allow the user to add any text they may want before sending. 我想显示电子邮件,以允许用户在发送之前添加他们可能想要的任何文本。 It works as expected in localhost however in production it fails to display the email. 它可以在本地主机中按预期工作,但是在生产中它无法显示电子邮件。 My code is as follows: 我的代码如下:

OutlookApp outlookApp = new OutlookApp();
MailItem mailItem = outlookApp.CreateItem(OlItemType.olMailItem);

mailItem.To = address;
mailItem.Subject = subject;
mailItem.HTMLBody = body;

mailItem.Importance = OlImportance.olImportanceNormal;

mailItem.Display(false);

Outlook opens just fine when I use a Response.Redirect instead of the above. 当我使用Response.Redirect而不是上面的方法时,Outlook可以很好地打开。

Response.Redirect("mailto:" + email + "?subject=" + subject + "&body=" + body);

Any ideas/suggestions? 有什么想法/建议吗?

Create an EML (MIME) message with attachments etc. on the server and let the user download it. 在服务器上创建带有附件等的EML(MIME)消息,然后让用户下载。 Outlook on the client side will be happy to open it. 客户端的Outlook将很乐意将其打开。 Don't forget to add the X-Unsent:1 MIME header to make sure the user can actually send it. 不要忘记添加X-Unsent:1 MIME标头,以确保用户可以实际发送它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM