I got a question an error message I am getting when trying to use system.web.mail.
I get an error message --> Could not access CDO.Message object <----
I do not understand getting this message because I am not using CDO.Message.
I have supplied the code below.
Imports System.Web.Mail
Module Module1
Sub Main()
Dim email As New System.Web.Mail.MailMessage
email.To = "test@test.com"
email.From = "myTest@test.com"
email.Subject = "SubjectText"
email.Body = "MessageText dotNet"
email.BodyFormat = System.Web.Mail.MailFormat.Html
System.Web.Mail.SmtpMail.SmtpServer = "dpoitla04"
'System.Web.Mail.SmtpMail.Send(email)
'email = Nothing
Dim astring As String
Dim bstring As String
Dim mstring As String
Try
'SmtpMail.Send(mail)
System.Web.Mail.SmtpMail.Send(email)
Catch ex As Exception
mstring = ex.Message.ToString
astring = "The following exception occurred: " + ex.ToString()
'check the InnerException
While Not (ex.InnerException Is Nothing)
bstring = "The following InnerException reported: " + ex.InnerException.ToString()
ex = ex.InnerException
End While
End Try
email = Nothing
End Sub
End Module
I get an error message --> Could not access CDO.Message object <----
I do not understand getting this message because I am not using CDO.Message.
I have supplied the code below.
Imports System.Web.Mail
Module Module1
Sub Main()
Dim email As New System.Web.Mail.MailMessage
email.To = "test@test.com"
email.From = "myTest@test.com"
email.Subject = "SubjectText"
email.Body = "MessageText dotNet"
email.BodyFormat = System.Web.Mail.MailFormat.Html
System.Web.Mail.SmtpMail.SmtpServer = "dpoitla04"
'System.Web.Mail.SmtpMail.Send(email)
'email = Nothing
Dim astring As String
Dim bstring As String
Dim mstring As String
Try
'SmtpMail.Send(mail)
System.Web.Mail.SmtpMail.Send(email)
Catch ex As Exception
mstring = ex.Message.ToString
astring = "The following exception occurred: " + ex.ToString()
'check the InnerException
While Not (ex.InnerException Is Nothing)
bstring = "The following InnerException reported: " + ex.InnerException.ToString()
ex = ex.InnerException
End While
End Try
email = Nothing
End Sub
End Module