Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I create web site using asp.net and I want to open outlook window in local machine when click the button

I do this:
C#
Microsoft.Office.Interop.Outlook.Application mApp = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.MailItem mEmail = null;
mEmail = (Microsoft.Office.Interop.Outlook.MailItem)mApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
mEmail.To = "chandana.pushpakumara@hayleysadvantis.com";
mEmail.Subject = "AMS Filling";
mEmail.Display();

This code run perfectly my local machine but i host the web site in IIS server give the following error:
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).

Please can any one help me to solve this problem

Thank you
Posted
Updated 18-Sep-12 20:11pm
v2
Comments
Sandeep Mewara 19-Sep-12 2:13am    
I hope you understand that you are trying to open Outlook on webserver and not on client system.

If you are aware of it, I would like to know the use-case where you have to open outlook on webserver via web application.
pvchandana 19-Sep-12 2:24am    
I want to Open Outlook in client machine and Web application run in server

You can use simple link to open outlook as

C#
<a href="mailto:">mail</a>
 
Share this answer
 
Comments
pvchandana 19-Sep-12 2:22am    
This work with out attachment but I want to attach excel file with email.
If you have to solution how to attach file please tell me

Thank you for you answer
uspatel 19-Sep-12 2:44am    
You can send mail with attachment using System.Net.Mail.
see
http://stackoverflow.com/questions/1195111/c-sharp-mailto-with-attachment
pvchandana 19-Sep-12 7:49am    
I do not want to send the email i want to open outlook with attachment
Calvijn 25-Feb-14 14:54pm    
The href "mailto:" is not bind to Outlook.
It just open the installed "Default" E-Mail Program on the client.
So it could be any E-Mail Software besides Outlook...
it is because of the privilege issues of processes.I hope this link will help
http://support.microsoft.com/kb/870655[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900