VB.Net and Outlook

G

Guest

Having a problem sending emails through vb.net. Our inhouse software
automatically sends an email to the programming staff whenever an error is
encountered.

This code works just fine on machines that are windows 2000 based. We
recently upgraded from Outlook 2000 to Outlook 2003, and it still works.

We have one machine with XP service pack 1. It works fine there. This also
was upgraded from outlook 200 to outlook 2003.

On two new machines, we have XP Service Pack 2. They came with outlook 2003,
so no upgrade was needed. On these machines, we get an error stating that
"modAgentSys can not create activex component" which then crashes the program.

Any ideas?
 
N

Nick Malik [Microsoft]

please provide more information about the app. You said it is written in
vb.net. Is it a rich client app or a web app? Are you using the .net
classes for sending mail? Can you post a snippet of code?

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 
G

Guest

Jan. 12, 2005

Windows XP Sp2 blocks ActiveX controls from being run. This is why
your ActiveX control is getting an error message. You should specify
somewhere in the computer settings that your control should be able to run.
Don't ask me how, :) but this is my opinion! Good luck!


Joseph MCAD
 
G

Guest

It is written in VB.Net 2002. It is a windows Application, not a Web app. I
don't know about the .Net classes for sending email...I am using the
Microsoft Outlook 11.0 Object Library. Code follows:

Dim olApp As Outlook.Application
olApp = CreateObject("Outlook.Application")
Dim olNs As Outlook.NameSpace
olNs = olApp.GetNamespace("MAPI")
olNs.Logon()
Dim olMail As Outlook.MailItem
olMail = olApp.CreateItem(Outlook.OlItemType.olMailItem)
olMail.To = lsTo
olMail.Subject = lsTitle
olMail.Body = lsBody
CType(olMail, Outlook._MailItem).Send()
 
N

Nick Malik [Microsoft]

You are using an ActiveX control to send mail. I can't see that you are
using Outlook functionality per se.

I suggest that you recode this segment of the code to use the .Net
framework. ActiveX controls have security issues, and XP SP2 has specific
settings the can prevent an ActiveX control from loading.

You can use the System.Web.Mail classes to send e-mail or you can use one of
the open source or free .Net e-mail classes that don't require CDO under the
covers.

I stumbled on this one using google. Haven't tried it myself. There's an
open source smtp component on sourceforge as well.
http://www.dnzone.com/ShowDetail.asp?NewsId=674

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 
G

Guest

Jan. 12, 2005

Here is some code to send a basic message. The from property is
required...

Imports System.Web.Mail

dim mess as new mailmessage
mess.from = "(e-mail address removed)"
mess.to = "(e-mail address removed)"
mess.body = "email's message"
mess.priority = mailpriority.high
mess.subject = "email subject"
'SmtpMail.Send and .SmtpServer methods are shared
smtpmail.smtpserver = "name of your smtp server"
smtpmail.send(mess)
messagebox.show("Your message has been sent.")

I didn't test this, but this is all there is to it! :) Have a great day!



Joseph MCAD
 
G

Guest

To make matters more confusing, we have a development machine that is XP Sp2
and the email works fine on it.
 

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

Top