I am writing a project in asp.net C# using Visual Studio 2010.
I want to write function, which opens outlook window to send email when user clicks a button.
I tried this:
using Outlook = Microsoft.Office.Interop.Outlook;
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 );
But compiler says there is no namespace Office inside namespace Microsoft.
Actually Microsoft Office including Outlook fully installed in my computer.
Should I include Office library to Visual Studio?
How the problem can be solved?
If you use
Microsoft.Office.Interop.Outlook, Outlook must be installed on the server (and runs on the server, not on user computer).Have you tried using SmtpClient?