473,770 Members | 6,133 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can not access CDO.Message object

Hi,
I am using VB.NET2003 on a Windows XP. I tried to
write a simple program to send email with attachment (see
below for the code). I add reference to "Microsoft CDO
1.21 library" and "Microsoft CDO for Windows2000libr ary".
It was compiled successfully. But I got run-time error
message "Can not access 'CDO.Message' object".
Did I miss something for XP here like PIA of CDO??
Thank you for your input!

Carol

Sub main()
Dim sTo As String, sFrom As String, sSubject As
String, sBody As String
Dim sAttach As String, sCc As String, sBcc As
String, sBodyEncoding As String
Dim sBodyFormat As String, sMailServer As String,
sPriority As String

Dim iLoop1 As Integer

sTo = "My****@hotmail .com"
sFrom = "my****@MyCom.c om"
sSubject = "Test from Bachow"
sBody = "Test from MyCom"
sAttach = "R:\Load\Report \Latest_Signals .csv"
sCc = "Ot********@MyC om.com"
sBcc = "Ot********@MyC om.com"
sBodyFormat =
System.Text.Enc oding.ASCII.Enc odingName
sBodyEncoding = Web.Mail.MailFo rmat.Text
sPriority = Web.Mail.MailPr iority.Normal

Dim MyMail As System.Web.Mail .MailMessage = New
System.Web.Mail .MailMessage

MyMail.From = sFrom
MyMail.To = sTo
MyMail.Subject = sSubject
MyMail.Body = sBody
MyMail.Cc = sCc
MyMail.Bcc = sBcc

' Build an IList of mail attachments.
If sAttach <> "" Then
Dim delim As Char = ","
Dim sSubstr As String
For Each sSubstr In sAttach.Split(d elim)
Dim myAttachment As MailAttachment = New
MailAttachment( sSubstr)
MyMail.Attachme nts.Add(myAttac hment)
Next
End If
Try
System.Web.Mail .SmtpMail.SmtpS erver
= "Bachowimail.Ba chow.com"
System.Web.Mail .SmtpMail.Send( MyMail)

Catch ex As Exception
Console.WriteLi ne("Can not send Email :" &
ex.Message)
End Try

End

Jul 21 '05 #1
1 3207
Hi Carol,

CDO.Message is the object used when sending emails. I've had this error many
times and it was ALWAYS a problem connecting to the email server.
What you can try is change the email server (SmtpMail.SmtpS erver). Also if
you don't, you can try to start the smtp server.

Hope this helps,
Michel

"Carol" <an*******@disc ussions.microso ft.com> wrote in message
news:19******** *************** *****@phx.gbl.. .
Hi,
I am using VB.NET2003 on a Windows XP. I tried to
write a simple program to send email with attachment (see
below for the code). I add reference to "Microsoft CDO
1.21 library" and "Microsoft CDO for Windows2000libr ary".
It was compiled successfully. But I got run-time error
message "Can not access 'CDO.Message' object".
Did I miss something for XP here like PIA of CDO??
Thank you for your input!

Carol

Sub main()
Dim sTo As String, sFrom As String, sSubject As
String, sBody As String
Dim sAttach As String, sCc As String, sBcc As
String, sBodyEncoding As String
Dim sBodyFormat As String, sMailServer As String,
sPriority As String

Dim iLoop1 As Integer

sTo = "My****@hotmail .com"
sFrom = "my****@MyCom.c om"
sSubject = "Test from Bachow"
sBody = "Test from MyCom"
sAttach = "R:\Load\Report \Latest_Signals .csv"
sCc = "Ot********@MyC om.com"
sBcc = "Ot********@MyC om.com"
sBodyFormat =
System.Text.Enc oding.ASCII.Enc odingName
sBodyEncoding = Web.Mail.MailFo rmat.Text
sPriority = Web.Mail.MailPr iority.Normal

Dim MyMail As System.Web.Mail .MailMessage = New
System.Web.Mail .MailMessage

MyMail.From = sFrom
MyMail.To = sTo
MyMail.Subject = sSubject
MyMail.Body = sBody
MyMail.Cc = sCc
MyMail.Bcc = sBcc

' Build an IList of mail attachments.
If sAttach <> "" Then
Dim delim As Char = ","
Dim sSubstr As String
For Each sSubstr In sAttach.Split(d elim)
Dim myAttachment As MailAttachment = New
MailAttachment( sSubstr)
MyMail.Attachme nts.Add(myAttac hment)
Next
End If
Try
System.Web.Mail .SmtpMail.SmtpS erver
= "Bachowimail.Ba chow.com"
System.Web.Mail .SmtpMail.Send( MyMail)

Catch ex As Exception
Console.WriteLi ne("Can not send Email :" &
ex.Message)
End Try

End

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5722
by: Ian | last post by:
The beginning of my assembly that I am getting the access error from looks like this. ********************************* Imports System.EnterpriseServices Imports System Imports System.Collections Imports System.Configuration Imports System.Data Imports System.Data.Common Imports System.Reflection
14
5420
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB 7.2 environment, the choices the optimizer makes often seem flaky. But this last example really floored me. I was hoping someone could explain why I get worse response time when the optimizer uses two indexes, than when it uses one. Some context:
4
15855
by: Otis Hunter | last post by:
I have been given an Access Database which contains a table that has an OLE object field that contains a Word document. That table contains hundreds of records. I would like to find out how I can write a VB script, to be executed either within Access or executed at the CMD prompt, which will loop through all the records and open the document object and save it to a Word document that I can access from Windows Explorer. An additional info...
7
8869
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
11
6600
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on where the job is running, the job runs sucessfully, PDF files got generated, everything is good. If I scheduled the job to run at the time that I am not logged into the server, Access is not able to print to the printer. The error is pretty...
7
2727
by: Ian Davies | last post by:
Is the runtime version of Access for distribution, that is available with the developer extensions a fully functional version of Access apart from the ability to create, edit and code a database? I am particularly interested to know if the Linked Table Manager will function, as I make use of this in one of my applications as a way the user can reconnnect to the backend if they should choose to move it to a different location after...
2
18941
by: Brent Burkart | last post by:
I am trying to send an email using SMTP server through IIS. I am recieving the following error. Access is denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.UnauthorizedAccessException: Access is denied.
3
9256
by: Jens | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object” when I call SmtpMail.Send. This only happens when I send e-mail addresses out side my company walls. When the e-mail is send on some one in my company it works perfect. I think it is a relay issue. Our system administrator will not allow relaying. In the ASP.Net web.config file I let the web application...
3
2100
by: Shawn | last post by:
Hi. In my application I store information about the user in the session object. Since I'm storing sensitive information I encrypt it before storing and decrypt it when I need to use it again. The encryption object I use is stored in the Application object. My problem is that after a while the encryption object becomes unusable. When I retrieve the object from Application and call the decrypt method I get an exception saying "Cannot...
9
3838
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web site for a small club I belong to and one of the features I would like to include is the ability to allow users to upload image files. unfortunately the servers web root www folder only allows READ and EXECUTE permissions, which makes it...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10231
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10005
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5452
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.