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?