"Could not access 'CDO.Message' object."?

rmatthew

Well-known member
Joined
Dec 30, 2002
Messages
115
Location
Texas
I am trying to send an email with the following code:

[VB]
Dim smt As System.Web.Mail.SmtpMail
Dim sm As New System.Web.Mail.MailMessage()

sm.To = registry.Read(clspmRegistry.RegKeysEnum.EmailErrors)
sm.Subject = strSubject
sm.From = strFron
sm.Body = strBody
sm.Priority = Web.Mail.MailPriority.High
smt.SmtpServer = "[my email server]"
smt.Send(sm)
[/VB]

I am getting "Could not access CDO.Message object." ?? I am finding alot of references to this problem but no solutions on the web. Got any ideas?

Also, what I really need to do is send through an email server that requires a username and a password but I dont see any properties for this object that allows those to be set....

Is there a better way??
 
Last edited by a moderator:
I remember seeing an option to install CDO objects when I was installing Outlook. It was one of the options that could be turned on and off from the installation. Perhaps you need to install Outlook or something that has these separate.
 
Do you have A SMTP server installed and running? If you do, try to comment the line smt.SmtpServer = "[my email server]" and you local SMTP server is going to be used by default.
 
cdo message object answer

We dealt with this issue the other day, try giving your mailroot, under inetpub, the aspnet user perrmission to read and write

this resolved our issue, let me know if works.
 
Local SMTP server works

I tried CASSIOs suggestion and installed the IIS server on PC.
Then turn off IIS webserver but leave SMTP server running.

It worked with my .NET VB program.

Thanks!!!
 
more about cdo.message error

More information regarding "Could not access CDO.Message object". I have a development network of 5 computers. I can successfuly send an e-mail from a laptop using System.Web.Mail.SmtpMail. The laptop is the only machine I have that is running Visual Studio. All other computers generate the error message.

I have tried changing permissions on the mailroot directory with no luck. I noticed that by stopping the default SMTP virtual server, I see a message (*.eml) in the pickup directory on the machine that works. On the others, no file appears.

I think with this information were going to get close to understanding why this problem occurs. The fixes mentioned above are doing something but we dont know what.

Any more ideas would be appreciated.
 
You can acquire CDO in one of several ways, for example:

Windows 95/98/NT Workstation:Download Outlook
Windows NT Server:Download Exchange
When you install Outlook , you should have cdo.dll, cdohtml.dll, and mapi32.dll installed onto your system
 
Hi,
I have recently reinstalled a new notebook with Windows 2003 Server RTM.

I have had ASP.NET (vb.net) code running on Windows 2000 and XP successfully.

The code I have used is:
Dim objMail As New System.Web.Mail.MailMessage()
objMail.Subject = "SMS Threshold Alert"
objMail.To = Me.ThresholdEmailAddress
objMail.Bcc = "info@f5.com.au"
objMail.From = ConfigurationSettings.AppSettings.Get("EMAIL_SENDER")
objMail.BodyFormat = Mail.MailFormat.Html
objMail.Body = "Hi " & Me.Name
Mail.SmtpMail.Send(objMail)

I have tried all sorts of permissions on the c:\inetpub\mailroot\* directories.

I have put the CDO dlls into Component Services and the CDO.Mesage object spins up (ie. starts spinning) but I still get the exception raised...

Any Ideas?

Thanks in Advance,
Angus Logan
email / msg: angus.logan@f5.com.au
 
I had the same prob but somehow figured it

Hi,

I was facing the same prob. I was able to send the mail from my development m/c but on deployment srvr i was getting the same prob. The prob was that the default smtp srvr on the deployment srvr was not functioning properly so v were using a diff smtp srvr. I removed try catch and got to know the exact err. The err was that the smtp srvr i was using was not allowing me to relay the mails. So the err.

I dont this helps u but u may try this thing or if there is anything else let me know.

bye,
Rohit
 
Check out the SMTP Properties...

Hi,

I faced the same problem but thanks to this thread I figured out why...

The errors I received:
- [HttpException (0x80004005): Could not access CDO.Message object.]
- [COMException (0x8004020f): The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for username@server.com

"Could not access CDO.Message" didnt say that much about the problem but the word "Relay" of the COMException did. Its gotta be something in the SMTP-Server Relay restrictions...

Open the SMTP Properties, select the Access-tab, click the Relay-button. Selecting "All except the list below" fixes the problem. Note that the when doing this the virtual server could end up propagating SPAM e-mail.

Using the option "Only the list below" is much better and should be safe enough. Simple add the IP Address of the localhost, 127.0.0.1
 
Last edited by a moderator:
I had a similar problem today and came here to look for help. I already had the cdo.dlls. I had used the mail server before successfully.

Here is what I found! The SMTPServer that I was trying to use wasnt resolving in DNS. I was using a local server named Felder ( the name isnt important ). I tried to telnet in with "telnet felder 25" and didnt get a response. I tried to ping felder and didnt get a response. Then I tried to ping the fully qualified domain name felder.blah.blah.com which worked. Then I put SmtpServer = "felder.blah.blah.com" and bingo it worked.

The point I making is that when you cant connect to the SmtpServer you get the cryptic message "Could not access CDO.Message object.

I hope this helps.
 
I have experienced this error a lot and I have found one or more of the following reasons for it:
1- The ASPNET account has limited rights
2- The SMTP is either not installed/running or is misconfigured
3- The SMTP set-up does not allow the client to send thro itself
4- The version of dlls are old.

I overcame my problems by
1- Fixing the ASPNET rights .... just minimum to send mails
OR
2- Providing the SMTP server as its actual IP and not 127.0.0.1 even if it is a local server. Use its real IP
3- Use another SMTP server

-A
http://www.autojobapply.com/
[Send your resume to thousands of job-opennings within minutes! Automate your job hunt!]
 
"Could not access CDO.Message object".

I have the same problem... The problem is based teh fact that I am running 2003.net, when you have autentication turned on, and send mail before the user is autreticated in the group. You know email address verification (like this site uses).
(yes a clue, but have not figured it out)

Here is what I have leanred...
1. If I log on through my firewall, It works (while every one who logs on the server from a remote location fails - yes we block 135 on the server)
2. If I log on from a differnt user I get the error
3. If I manage to autenticate a user, then it works,a dn the user can send mail
4. if I do not have an authenticated user, then it fails
5. If I change the default app settting (per some other posts) it fails (Yes I have treid just about everything people have said)
6. if I change the mailroot/queuue and give the IIWS user write priv, it fails
7. It runs on windows 2000 server (with 1.1), but fails on 2003.
8. Having smtp installed on the server (or not ) does not effect anything) -- as expceted, sinve we throw mail to anotehr server to process it
9. have cofigured the host files to resolve correctly (dont forget it works, if you are autenticated)

Clearly it is a persmission problem.
fyi: You need to test it from a system outside of your network


Solution???

Im open to try anything
 
Does anyone know how to save the email to a directory? instead of sending it (SmtpMail.Send)? as I want to add a cert to it.
 
Note that "Could not access CDO.Message object." is a generic error message.

To view the actual error try:

ex.InnerException.InnerException.Message

;)
 
There is one further cause for a CDO.Message instantiation failure. It seems by default that .NET uses the loopback address (127.0.0.1) a the origin for the SMTP action. Therefore, the following must be set in IIS:
1. The IP address for the SMTP site must be set to <all unassigned>
2. Access-Connections - Either allow all, or make sure the loopback address appears in the list of allowed IPs.
3. Access-Relay - Same with Connections
 
I was able to fix this problem by using the following code

<smtpMailObject>.smtpserver.insert(0,"server name")

insted of

<smtpMailObject>.smtpserver = "server name"
 
My second experience with "Could not access CDO.Message object."

My second experience with "Could not access CDO.Message object."

The first time I had it problem it was due to the cdo DLLs not on the server. That was serveral months ago. I setup outlook on the server and that fixed that was fixed. On a different server I setup IPsec packet filtering and it caused the the same "Could not access CDO.Message object." error. Catch the comexception error and it will give you a more descriptive error message than the general httpexception would. To fix this problem the second time all I had to do was unfilter port 25 for SMTP. IT just sucks that the http exception delivers the same "Could not access CDO.Message error message. I think MS just likes to play with us. I know I would. Hope that helps someone
 
One thing that I have found is that if you use the .SmtpServer property, it will not always resolve domain names correctly. I use the IP adderess, and, all other things being correct, it works fine.
Regards,

Lee
 
Ensure that you have correctly formed email addresses. For example:

Dim mMessage As New MailMessage
With mMessage
.From = "Automated Mail"
.To = "you@yourhouse.com"
End With

will result in >> Could not access CDO.Message object.

(InnerException.Message)
The server rejected the sender address. The server response was: 553 malformed address: <Automated Mail>

removing the space, in this instance, from the .From property will resolve the error.

Imports System.Web.mail

Sub sendmail()

Dim mMessage As New MailMessage
With mMessage
.From = "AutomatedMail"
.To = "you@yourhouse.com"
End With

SmtpMail.SmtpServer = "[servername]"
SmtpMail.Send(mailMsg)

End Sub


Note: some email servers will have policy restrictions applied to them to prevent spam, e.g. mail may only be allowed to go external if its origin is safe.
 
Last edited by a moderator:
Back
Top