sending email from outlook

K

KatMagic

The following code wrks fine when running from my pc (localhost); but errors
when I put the asp.net code up to the production web server. Theerror I get
is System.Runtime.InteropServices.COMException: COM Object ... is either not
valid or not registered.

What am I missing?


My code:
Public Function CallOutlook()

Dim oOutlook As New Outlook.Application()

Dim oMailitem As Outlook.MailItem

oMailitem = oOutlook.CreateItem(Outlook.OlItemType.olMailItem)

oMailitem.To = (e-mail address removed)

oMailitem.Cc = (e-mail address removed)

oMailitem.Subject = "Email Integration with Outlook and VB.Net"

oMailitem.Display()

End Function
 
K

KatMagic

Because we have a web application where we want our users to click on a link
to open an outlook email and send an email. What other reason would there
be. This is an internal server, not used by anyone other than our own
employess.
 
M

Mark Fitzpatrick

I think the response you received is referring to the fact that this will do
absolutely nothing for a user because it is on the web server. This is not
going to create an outlook email that the user can do anything with. This is
trying to instantiate an instance of Outlook on the web server itself. The
user would never see this and it wouldn't open an email for the user since
it is not going to happen on the users computer. The best thing you can do
is to create a hyperlink and use the "mailto:" version so that it will open
an email message in the user's default email client.

You can specify one user to send it to as follows:

mailto:[email protected]

The specifications say that you cannot use more than one address to send to,
though a lot of people do this simply by adding comma's between them. This
is not supported though and is not part of the RFC that governs how a URL
should appear so use a comma delimited list with caution. You can add a
subject by placing ?subject= followed by the subject like so:

mailto:[email protected]?subject=Email Integration with Outlook and VB.Net

The subject isn't supported either, but a lot of clients do support it.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
M

Mark Rae

Because we have a web application where we want our users to click on a
link to open an outlook email and send an email. What other reason would
there be. This is an internal server, not used by anyone other than our
own employess.

Oh right - so your employees all use the webserver as their desktop
workstation...?
 
B

bruce barker \(sqlwork.com\)

outlook requires user profile. web applications do not have one. also you
are calling display, which if it worked (won't because web apps do not have
access o the desktop) , wuld popup the mail dialog on the server.

-- bruce (sqlwork.com)
 
K

KatMagic

You're right, I wasn't understanding it like I should have, I was taking it
from a windows app. However, when I search for "Using Outlook with
ASP.NET", this is the code I got. But thanks for making this clear. I get
it now. This is just what I needed!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top