468,241 Members | 1,508 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,241 developers. It's quick & easy.

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

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
1 2146
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.

Similar topics

2 posts views Thread by Desmond | last post: by
2 posts views Thread by Paul Glavich | last post: by
2 posts views Thread by MattB | last post: by
2 posts views Thread by Martin | last post: by
1 post views Thread by tshad | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.