在Outlook中使用C#创建邮件但不发送显示。 [英] Create a mail using C# in outlook but do not send instead display.
问题描述
我有一个场景,我必须使用C#创建一个电子邮件。附上一个excel文件然后发送,而不是发送它,让用户有机会查看它然后手动发送。
VBA中有相同的功能,如果使用它。它发送邮件,如果使用.Display它弹出邮件给用户看。
如果C#中有可能,请告诉我。
谢谢,
Sajid
Hi,
I have a scenario where i have to create an email using C#. Attach an excel file and then instead of sending it, give a chance to user to view it and then send it manually.
Same kind of functionality is available in VBA where if used .send it sends mail, and if used .Display it pops up the mail to users to see.
Let me know if this is possible in C#.
Thanks,
Sajid
推荐答案
嗨Sajid,
你真的可以做它就这么简单,使用下面的代码:
----------------------- --------------------------------------
Hi Sajid,
You can really do it and it's that simple, use the codes below:
-------------------------------------------------------------
Microsoft.Office.Interop.Outlook.Application app = new
Microsoft.Office.Interop.Outlook.Application();
MailItem item = app.CreateItem((OlItemType.olMailItem));
item.BodyFormat = OlBodyFormat.olFormatHTML;
item.To = "a@test.com;b@test.com;c@test.com";
item.BCC = "cc@test.com";
item.Body = "Hello There!";
item.Display();
------------------------- ------------------------------------
Happy Coding :)
干杯!!
-------------------------------------------------------------
Happy Coding :)
Cheers!!
这篇关于在Outlook中使用C#创建邮件但不发送显示。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!