Problem using system.web.mail

csphard

New member
Joined
Mar 2, 2005
Messages
3
Programming Experience
10+
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
 
That is a general error message suggestion something is wrong with smtp server or something is wrong with communication with smtp server. Your use of innerexception should give you more specific information about whats wrong if you read all the bstrings.
 
Back
Top