By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,137 Members | 2,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,137 IT Pros & Developers. It's quick & easy.

WebMail Not Working! "Could not access 'CDO.Message' object"

P: n/a
I am trying to send mail via SMTP, using VB.NET on XP. I keep getting this
error: "Could not access 'CDO.Message' object." (I can send mail fine via
VB6, using CDONTS.)

I have added a reference to System.Web, and this is my code:

Try

WebMailMessage.From = Sender

WebMailMessage.To = Recipient

WebMailMessage.Body = Body

WebMailMessage.Subject = Subject

WebMail.SmtpServer = "localhost" 'Tried SMTPServerString and IP Number as
well

WebMail.Send(WebMailMessage)

Catch e As System.Exception

Debug.Write(e.Message)

MsgBox("SendMailMessage failed with the following exception:" & e.Message)

End Try
All of the values are passed by the class I wrote (Sender, Body, etc.). I
have tried switching the SMTP Server value to the name of my SMTP server,
and to its IP number, but I keep getting the same error. Do I need to add a
COM reference to CDO in my project or what?
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Check out:

http://www.systemwebmail.net/

You have added a reference to System.Web right?

If using SmtpServer = "localhost" you also have to setup your SMTP server on
the machine running your code to allow relaying to 127.0.0.1 (Look in
IIS->Default-SMTP->Properties->Access tab->Relay->Add 127.0.0.1)

HTH,
Greg
"Jason" <so*****@microsoft.com> wrote in message
news:ud**************@tk2msftngp13.phx.gbl...
I am trying to send mail via SMTP, using VB.NET on XP. I keep getting this
error: "Could not access 'CDO.Message' object." (I can send mail fine via
VB6, using CDONTS.)

I have added a reference to System.Web, and this is my code:

Try

WebMailMessage.From = Sender

WebMailMessage.To = Recipient

WebMailMessage.Body = Body

WebMailMessage.Subject = Subject

WebMail.SmtpServer = "localhost" 'Tried SMTPServerString and IP Number as
well

WebMail.Send(WebMailMessage)

Catch e As System.Exception

Debug.Write(e.Message)

MsgBox("SendMailMessage failed with the following exception:" & e.Message)

End Try
All of the values are passed by the class I wrote (Sender, Body, etc.). I
have tried switching the SMTP Server value to the name of my SMTP server,
and to its IP number, but I keep getting the same error. Do I need to add
a COM reference to CDO in my project or what?

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.