I am using the following cdos code to connect to a remote smtp mail server. it works perfectly when a valid email address is given, if a fake one is given then it errors the page. is their anyway to prevent this? i tried the javascript approach but it still fails sometimes.
Const cdoSendUsingMethod = _
"Const cdoSendUsingPort = 2
Const cdoSMTPServer = _
"Const cdoSMTPServerPort = _
"Const cdoSMTPConnectionTimeout = _
"Const cdoSMTPAuthenticate = _
"Const cdoBasic = 1
Const cdoSendUserName = _
"Const cdoSendPassword = _
"
Dim objConfig ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields ' As ADODB.Fields
' Get a handle on the config object and it's fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
' Set config fields we care about
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = ""
.Item(cdoSMTPServerPort) = 587
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = "administrator@efbp.net"
.Item(cdoSendPassword) = ""
.Update
End With
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig
With objMessage
.To = strTo
.Bcc = "<>"
.From = "<>"
.Subject = ""
.TextBody = strMailBody
.Send
End With
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
Const cdoSendUsingMethod = _
"Const cdoSendUsingPort = 2
Const cdoSMTPServer = _
"Const cdoSMTPServerPort = _
"Const cdoSMTPConnectionTimeout = _
"Const cdoSMTPAuthenticate = _
"Const cdoBasic = 1
Const cdoSendUserName = _
"Const cdoSendPassword = _
"
Dim objConfig ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields ' As ADODB.Fields
' Get a handle on the config object and it's fields
Set objConfig = Server.CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
' Set config fields we care about
With Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = ""
.Item(cdoSMTPServerPort) = 587
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSMTPAuthenticate) = cdoBasic
.Item(cdoSendUserName) = "administrator@efbp.net"
.Item(cdoSendPassword) = ""
.Update
End With
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = objConfig
With objMessage
.To = strTo
.Bcc = "<>"
.From = "<>"
.Subject = ""
.TextBody = strMailBody
.Send
End With
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing