469,917 Members | 1,474 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

sending email from outlook

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 = a@a.com

oMailitem.Cc = b@b.com

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

oMailitem.Display()

End Function


Aug 31 '06 #1
6 1296
"KatMagic" <SS********@yahoo.comwrote in message
news:eX**************@TK2MSFTNGP02.phx.gbl...
What am I missing?
Well, first things first, why are you trying to instantiate Outlook on a web
server...?
Aug 31 '06 #2
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.
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
"KatMagic" <SS********@yahoo.comwrote in message
news:eX**************@TK2MSFTNGP02.phx.gbl...
>What am I missing?

Well, first things first, why are you trying to instantiate Outlook on a
web server...?

Sep 1 '06 #3
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:b@b.com

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:b@b.com?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

"KatMagic" <SS********@yahoo.comwrote in message
news:un**************@TK2MSFTNGP05.phx.gbl...
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.
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>"KatMagic" <SS********@yahoo.comwrote in message
news:eX**************@TK2MSFTNGP02.phx.gbl...
>>What am I missing?

Well, first things first, why are you trying to instantiate Outlook on a
web server...?


Sep 1 '06 #4
"KatMagic" <SS********@yahoo.comwrote in message
news:un**************@TK2MSFTNGP05.phx.gbl...
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...?
Sep 1 '06 #5
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)

"KatMagic" <SS********@yahoo.comwrote in message
news:eX**************@TK2MSFTNGP02.phx.gbl...
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 = a@a.com

oMailitem.Cc = b@b.com

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

oMailitem.Display()

End Function


Sep 1 '06 #6
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!

"Mark Fitzpatrick" <ma******@fitzme.comwrote in message
news:ug**************@TK2MSFTNGP02.phx.gbl...
>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:b@b.com

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:b@b.com?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

"KatMagic" <SS********@yahoo.comwrote in message
news:un**************@TK2MSFTNGP05.phx.gbl...
>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.
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>>"KatMagic" <SS********@yahoo.comwrote in message
news:eX**************@TK2MSFTNGP02.phx.gbl...

What am I missing?

Well, first things first, why are you trying to instantiate Outlook on a
web server...?



Sep 1 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Sven Templin | last post: by
13 posts views Thread by joe215 | last post: by
1 post views Thread by Devonish | last post: by
17 posts views Thread by Bonj | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.