How to open Outlook new mail window c#

Maciej picture Maciej · May 27, 2011 · Viewed 81.8k times · Source

I'm looking for a way to open a New mail in Outlook window.

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.

Found that:

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...)

Any advice(s) ?

Answer

Maciej picture Maciej · May 29, 2011

I've finally resolved the issue. Here is piece of code resolving my problem (using 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 );