views:

879

answers:

5

I have a web application developed with ASP.net and C# that is running on my companies' intranet. Because all the users for this application are all using Microsoft Outlook without exception, I would like for the the application to open up an Outlook message on the client-side. I understand that Office is designed to be run on the desktop and not from a server, however I have no trouble creating a Word or Excel document on the client-side.

I have code that instantiates the Outlook object using the Microsoft.Office.Interop.Outlook namespace and Outlook installed on the server. When I try to run the code from the server, I get a DCOM source error message that states "The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID {000C101C-0000-0000-C000-000000000046} to the user This security permission can be modified using the Component Services administrative tool." I have modified the permissions using the Component Services tool, but still get this same error.

Is there a way to overcome this or is this a fruitless exercise because Outlook cannot be opened on the client side from the server-side code?

Mailto will not work due to the extreme length that the emails can obtain. Also, the user that sends it needs add in eye-candy to the text for the recipients.

+5  A: 

You cannot open something on the client from server side code. You'd have to use script on the page to do what you're wanting (or something else client-side like ActiveX or embedded .NET or something)

Here's a sample Javascript that invokes an Outlook MailItem from an webpage. This could easily be injected into the page from your server-side code so it executes on the client.

http://www.codeproject.com/KB/aspnet/EmailUsingJavascript.aspx

Ryan Farley
+2  A: 

(hint: formatting in your question)

I'm not understanding what's wrong with a mailto link or a formmail-type page.

hometoast
no kidding formatting!!! sorry about that.
Keng
+1  A: 

If everyone in the company uses Outlook, then just using a standard "mailto" link should always open Outlook. It sounds like you're over-engineering this.

Jason
A: 

Do you want to open an existing E-Mail or create a new one?

Perhaps I misunderstand your question, but you can provide a link like

mailto:[email protected]?subject=This%20is%20the%20subject&body=Hello%20there!

When the user clicks on that a link, a new Outlook-E-Mail will be opened and the recipient is recipient@email-tld, the subject is "This is the subject" and the body is "Hello there!". All these fields are already filled from the link.

Doozer
A: 

I'll just throw this out there cuz it's been asked.

Mailto has a lot of disadvantages; mainly size. Since the sender needs to do alot of formatting on the email text, the html code generated can take up a lot of space that fails when using mailto.

thanks for the suggestion though.

Keng
Can you clarify this (possibly in the question itself)?It's not clear to me why a mailto: link should take up more "space" than anything else. Is the body of the mail completely auto-generated?
Oliver Giesen
@Oliver Giesen, it's not that mailto "takes up too much space". Mailto has certain length limitations, if your message is too long it will be truncated.
Ryan Farley