Solved

Opening New Outlook mail Message from Web Application

Posted on 2008-10-01
8
955 Views
Last Modified: 2012-05-05
I am trying to open a new outlook mail message from the click of a button on a web page.  My code also creates a new calendar item and attaches it to the email.  The body of the email is populated with data from my database.

I am getting the following error:

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046}

I have added the Microsoft.Office.Interop.Outlook.dll (version 12) to the product.  The dll is in the bin directory.

Everything works fine in development.  It does not work when I post on a production server.

Production server is running windows 2003

Do I need to install Outlook on the production server?
Dim objOutlook As New Outlook.Application
            Dim objOutlookMsg As Object
            Const olMailItem As Object = 0
            'Const olBCC As Integer = 3
            Const olImportanceHigh As Integer = 2
            'Const olCC As Integer = 2
            Const olTo As Integer = 1
 
            'objOutlook = CreateObject("Outlook.Application")
            objOutlookMsg = objOutlook.CreateItem(olMailItem)
            With objOutlookMsg
                Dim objOutlookRecip As Object = .Recipients.Add(strTakingAttorneyEmails)
                objOutlookRecip.type = olTo
                .Subject = strSubject
                .HTMLBody = parser.Parse
                '.Body = "TEST BODY"
                .Importance = olImportanceHigh
                'ADD THE ATTACHMENT TO THE EMAIL
                .Attachments.Add(strCalendarItem)
                .Display() ' use  .send() to send
 
            End With
            objOutlookMsg = Nothing
            objOutlook = Nothing

Open in new window

0
Comment
Question by:cartch2008
  • 4
  • 4
8 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 22620468
>>Do I need to install Outlook on the production server?

yes and you shouldn't do that!

0
 

Author Comment

by:cartch2008
ID: 22622966
What should I do then??
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 22623159
what are you trying to do exactly?

If you want to send email, you better use System.Net.Mail as shown at http://www.emoreau.com/Entries/Articles/2007/09/Using-SystemNetMail.aspx

If you want to create an appointment, see http://www.ascentium.com/blog/sp/Post57.aspx
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:cartch2008
ID: 22623528
I realize I can do that, but, my requirement from my client is that the new mail message pops up as a new outlook email message on his machine, with the body of the email populated with data from the database.   I can't just use a href mailto: becuase I can't pass all that data to the body of the email.
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 22623684
are you sure all the users of your wep site are using Outlook?

Can't you just create a web page with all the fields you need and send it using System.Net.Mail?

I think you can use WebDav to acheive it (open a Outlook Message): http://blog.downtownsoftwarehouse.com/2006/10/26/using-net-and-webdav-to-access-an-exchange-server/
0
 

Author Comment

by:cartch2008
ID: 22623869
Yes, I'm sure...absolutely sure
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 22624246
what about WebDav?
0
 

Author Closing Comment

by:cartch2008
ID: 31502222
I've scrapped my plans to use this functionality.  Although I did not try WebDav, I'm confident it would solve thie issue if I were to go ahead and implement it.  So, I am awarding you the points for that fact that you responded.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question