473,396 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 Windows2000library".
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.com"
sSubject = "Test from Bachow"
sBody = "Test from MyCom"
sAttach = "R:\Load\Report\Latest_Signals.csv"
sCc = "Ot********@MyCom.com"
sBcc = "Ot********@MyCom.com"
sBodyFormat =
System.Text.Encoding.ASCII.EncodingName
sBodyEncoding = Web.Mail.MailFormat.Text
sPriority = Web.Mail.MailPriority.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(delim)
Dim myAttachment As MailAttachment = New
MailAttachment(sSubstr)
MyMail.Attachments.Add(myAttachment)
Next
End If
Try
System.Web.Mail.SmtpMail.SmtpServer
= "Bachowimail.Bachow.com"
System.Web.Mail.SmtpMail.Send(MyMail)

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

End

Jul 21 '05 #1
1 3183
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.SmtpServer). Also if
you don't, you can try to start the smtp server.

Hope this helps,
Michel

"Carol" <an*******@discussions.microsoft.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 Windows2000library".
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.com"
sSubject = "Test from Bachow"
sBody = "Test from MyCom"
sAttach = "R:\Load\Report\Latest_Signals.csv"
sCc = "Ot********@MyCom.com"
sBcc = "Ot********@MyCom.com"
sBodyFormat =
System.Text.Encoding.ASCII.EncodingName
sBodyEncoding = Web.Mail.MailFormat.Text
sPriority = Web.Mail.MailPriority.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(delim)
Dim myAttachment As MailAttachment = New
MailAttachment(sSubstr)
MyMail.Attachments.Add(myAttachment)
Next
End If
Try
System.Web.Mail.SmtpMail.SmtpServer
= "Bachowimail.Bachow.com"
System.Web.Mail.SmtpMail.Send(MyMail)

Catch ex As Exception
Console.WriteLine("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
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...
14
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...
4
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...
7
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...
11
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...
7
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...
2
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...
3
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...
3
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...
9
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.