如何打开Outlook新邮件窗口的C#窗口、新邮件、Outlook

2023-09-09 21:03:07 作者:黑名单里的陌生人

我在寻找一种方式来在Outlook窗口中打开一个新的邮件。

我需要programically填写:从,到,主题,正文信息,但离开这个新邮件窗口中打开,以便用户可以验证内容/添加一些东西然后把正常的Outlook味精

I need programically fill: from, to, subject, body information, but leave this new mail window open so user can verify content / add something then send as normal Outlook msg.

发现:

Process.Start(String.Format(
 "mailto:{0}?subject={1}&cc={2}&bcc={3}&body={4}", 
  address, subject, cc, bcc, body))

但没有从选项(我的用户有多个邮箱...)

But there is no "From" option (my users have more than one mailbox...)

任何意见(S)?

推荐答案

I'cve终于解决了这个问题 这里是一片code解决我(和使用的Outlook互操作性展示)问题

I'cve finally resolved that issue Here is piece of code resolving my problem (with usage Outlook interops)

Outlook.Application oApp    = new Outlook.Application ();
Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem ( Outlook.OlItemType.olMailItem );
oMailItem.To    = address;
// body, bcc etc...
oMailItem.Display ( true );