Home All Groups Group Topic Archive Search About

sending email from outlook

Author
31 Aug 2006 11:35 PM
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 = a@a.com

oMailitem.Cc = b@b.com

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

oMailitem.Display()

End Function

Author
31 Aug 2006 11:43 PM
Mark Rae
"KatMagic" <SSKatMa***@yahoo.com> wrote in message
news:eX8vDXVzGHA.4932@TK2MSFTNGP02.phx.gbl...

> What am I missing?

Well, first things first, why are you trying to instantiate Outlook on a web
server...?
Author
1 Sep 2006 12:11 AM
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.


Show quote
"Mark Rae" <mark@markNOSPAMrae.com> wrote in message
news:%23$1mFdVzGHA.480@TK2MSFTNGP06.phx.gbl...
> "KatMagic" <SSKatMa***@yahoo.com> wrote in message
> news:eX8vDXVzGHA.4932@TK2MSFTNGP02.phx.gbl...
>
>> What am I missing?
>
> Well, first things first, why are you trying to instantiate Outlook on a
> web server...?
>
Author
1 Sep 2006 1:42 AM
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:

mailt***@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:

mailt***@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



Show quote
"KatMagic" <SSKatMa***@yahoo.com> wrote in message
news:unciqrVzGHA.5048@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" <mark@markNOSPAMrae.com> wrote in message
> news:%23$1mFdVzGHA.480@TK2MSFTNGP06.phx.gbl...
>> "KatMagic" <SSKatMa***@yahoo.com> wrote in message
>> news:eX8vDXVzGHA.4932@TK2MSFTNGP02.phx.gbl...
>>
>>> What am I missing?
>>
>> Well, first things first, why are you trying to instantiate Outlook on a
>> web server...?
>>
>
>
Author
1 Sep 2006 6:44 PM
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!

Show quote
"Mark Fitzpatrick" <markf***@fitzme.com> wrote in message
news:ug5iSfWzGHA.1536@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:
>
> mailt***@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:
>
> mailt***@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" <SSKatMa***@yahoo.com> wrote in message
> news:unciqrVzGHA.5048@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" <mark@markNOSPAMrae.com> wrote in message
>> news:%23$1mFdVzGHA.480@TK2MSFTNGP06.phx.gbl...
>>> "KatMagic" <SSKatMa***@yahoo.com> wrote in message
>>> news:eX8vDXVzGHA.4932@TK2MSFTNGP02.phx.gbl...
>>>
>>>> What am I missing?
>>>
>>> Well, first things first, why are you trying to instantiate Outlook on a
>>> web server...?
>>>
>>
>>
>
>
Author
1 Sep 2006 6:18 AM
Mark Rae
"KatMagic" <SSKatMa***@yahoo.com> wrote in message
news:unciqrVzGHA.5048@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...?
Author
1 Sep 2006 3:23 PM
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)

Show quote
"KatMagic" <SSKatMa***@yahoo.com> wrote in message
news:eX8vDXVzGHA.4932@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
>
>
>
>
>
>

AddThis Social Bookmark Button