Automating Outlook 2000

M

Matthew MacDonald

Hi all,

I'm trying to have an email message automatically generated when a button is
clicked on an asp.net web form. I'm using portions of the sample code from
http://msdn.microsoft.com/library/d...tomatingOutlookFromVisualBasicApplication.asp
to try and accomplish this. This code however, throws an error pretty much
right away at the "set OlNs = olApp.GetNamespace("MAPI")" line with an
invalid cast exception. Any suggestions on what could be causing this
and/or what other considerations should be made for using outlook from a web
form?

Thanks in advance,

Matt
 
T

Thomas Dodds

page codebehind:

Imports System.Web.Mail


in the event sub for the button:
Dim mailMessage As New MailMessage()

with mailMessage
.To = ""
.From = ""
....
end with

Smtpmail.SmtpServer = "SERVERNAME HERE"
SmtpMail.Send(mailMessage)
 
M

Matthew MacDonald

Thanks, but that doesn't really answer the question. I need to use Outlook because I am going off of an exchange server for internal messaging. I also need to use outlook for other reasons, but that is beyond the scope of this post.

Thanks anyway though.
page codebehind:

Imports System.Web.Mail


in the event sub for the button:
Dim mailMessage As New MailMessage()

with mailMessage
.To = ""
.From = ""
....
end with

Smtpmail.SmtpServer = "SERVERNAME HERE"
SmtpMail.Send(mailMessage)
 
T

Thomas Dodds

have you taken a look at: http://msdn.microsoft.com/vbasic/de...y/en-us/odc_ol2003_ta/html/odc_olomwvbnet.asp ?
Thanks, but that doesn't really answer the question. I need to use Outlook because I am going off of an exchange server for internal messaging. I also need to use outlook for other reasons, but that is beyond the scope of this post.

Thanks anyway though.
page codebehind:

Imports System.Web.Mail


in the event sub for the button:
Dim mailMessage As New MailMessage()

with mailMessage
.To = ""
.From = ""
....
end with

Smtpmail.SmtpServer = "SERVERNAME HERE"
SmtpMail.Send(mailMessage)
 
T

Thomas Dodds

also: http://www.c-sharpcorner.com/Internet/SendingEmailsThroughOutlookCB.asp
Thanks, but that doesn't really answer the question. I need to use Outlook because I am going off of an exchange server for internal messaging. I also need to use outlook for other reasons, but that is beyond the scope of this post.

Thanks anyway though.
page codebehind:

Imports System.Web.Mail


in the event sub for the button:
Dim mailMessage As New MailMessage()

with mailMessage
.To = ""
.From = ""
....
end with

Smtpmail.SmtpServer = "SERVERNAME HERE"
SmtpMail.Send(mailMessage)
 
M

Matthew MacDonald

That code crashed for me too with an Outlook Interface Failed error.
also: http://www.c-sharpcorner.com/Internet/SendingEmailsThroughOutlookCB.asp
Thanks, but that doesn't really answer the question. I need to use Outlook because I am going off of an exchange server for internal messaging. I also need to use outlook for other reasons, but that is beyond the scope of this post.

Thanks anyway though.
page codebehind:

Imports System.Web.Mail


in the event sub for the button:
Dim mailMessage As New MailMessage()

with mailMessage
.To = ""
.From = ""
....
end with

Smtpmail.SmtpServer = "SERVERNAME HERE"
SmtpMail.Send(mailMessage)
 
M

Matthew MacDonald

Is there any reason why you would not be able to access the MAPI namespace
when using an exchange server?
 
M

Matthew MacDonald

OK, I had to take a break from this project for a while, but now I'm back on
it. I got the code to where it won't crash by instantiating everything as
objects and not trying to cast them. I also found some security settings
that I needed to change. The problem I'm having now (hopefully the last) is
how to deal with the Outlook Security Update warnings. In a regular windows
app, you can just click through them, but that's not an option with web
forms. How do I get around this using web forms? Thanks for the help.

Matt
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top