While testing my sites that were just moved to the new server, I got an error sending email from .NET code.
The error logged by my code's try/catch block is as follows:
"Could+not+access+'CDO.Message'+object"
Here is the code I use:
Public Function SendEmail(ByVal FromEmail As String, ByVal ToEmail As String, ByVal Subject As String, ByVal Message As String) As Boolean
Dim ReturnValue As Boolean = False
Dim objMail As System.Web.Mail.SmtpMail
Dim objMsg As System.Web.Mail.MailMessage
objMsg = New Web.Mail.MailMessage()
objMsg.From = FromEmail
objMsg.To = ToEmail
objMsg.Subject = "(WebEmail): " & Subject
objMsg.Body = Message
objMsg.BodyFormat = MailFormat.Html
Try
objMail.Send(objMsg)
ReturnValue = True
Catch ex As Exception
mResponse.AppendToLog("Email error:" & ex.Message)
ReturnValue = False
End Try
Return ReturnValue
End Function
This worked on the old server. Any help on this would be appreciated.
Thanks,
riley
The error logged by my code's try/catch block is as follows:
"Could+not+access+'CDO.Message'+object"
Here is the code I use:
Public Function SendEmail(ByVal FromEmail As String, ByVal ToEmail As String, ByVal Subject As String, ByVal Message As String) As Boolean
Dim ReturnValue As Boolean = False
Dim objMail As System.Web.Mail.SmtpMail
Dim objMsg As System.Web.Mail.MailMessage
objMsg = New Web.Mail.MailMessage()
objMsg.From = FromEmail
objMsg.To = ToEmail
objMsg.Subject = "(WebEmail): " & Subject
objMsg.Body = Message
objMsg.BodyFormat = MailFormat.Html
Try
objMail.Send(objMsg)
ReturnValue = True
Catch ex As Exception
mResponse.AppendToLog("Email error:" & ex.Message)
ReturnValue = False
End Try
Return ReturnValue
End Function
This worked on the old server. Any help on this would be appreciated.
Thanks,
riley