Link to home
Start Free TrialLog in
Avatar of cartch2008
cartch2008

asked on

Opening New Outlook mail Message from Web Application

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

Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

>>Do I need to install Outlook on the production server?

yes and you shouldn't do that!

Avatar of cartch2008
cartch2008

ASKER

What should I do then??
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
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.
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes, I'm sure...absolutely sure
what about WebDav?
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.