3

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.

Keng
  • 52,011
  • 32
  • 81
  • 111

5 Answers5

6

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
  • 11,315
  • 4
  • 46
  • 43
2

(hint: formatting in your question)

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

hometoast
  • 11,522
  • 5
  • 41
  • 58
1

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
  • 86,222
  • 15
  • 131
  • 146
1

Do you want to open an existing E-Mail or create a new one? Perhaps I misunderstood your question; could you provide a link like:

mailto:recipient@email.tld?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: recipient@email-tld
  • Subject: This is the subject
  • Body: Hello there!

All these fields are already filled from the link.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Doozer
  • 186
  • 2
  • 2
1

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
  • 52,011
  • 32
  • 81
  • 111
  • 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 Sep 19 '08 at 07:55
  • @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 Sep 23 '08 at 14:19