for sending mail CDO object is used but giving transport errror 0x80040217.
But the same code is running on live in another server.
I am using the port 25,also having authentication.I am facing this problem last 10 days.Please resolve.
Expand|Select|Wrap|Line Numbers
- Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
- Const cdoSendUsingPort = 2
- Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
- Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
- Const cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
- Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
- Const cdoBasic = 1
- Const cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername"
- Const cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword"
- Dim objConfig
- Dim objMessage
- Dim Fields
- Set objConfig = CreateObject("CDO.Configuration")
- Set Fields = objConfig.Fields
- With Fields
- .Item(cdoSendUsingMethod) = cdoSendUsingPort
- .Item(cdoSMTPServer) = "<smtp server>"
- .Item(cdoSMTPServerPort) = 25
- .Item(cdoSMTPConnectionTimeout) = 100
- .Item(cdoSMTPAuthenticate) = cdoBasic
- .Item(cdoSendUserName) = "<username>"
- .Item(cdoSendPassword) = "<password>"
- .Update
- End With
- Set objMessage = CreateObject("CDO.Message")
- Set objMessage.Configuration = objConfig
- With objMessage
- .To = "'Name' <Adress>"
- .from = "'Name' <Adress>"
- .Subject = "SMTP Relay Test"
- .TextBody = "SMTP Relay Test Sent @ " & Now()
- .Send
- End With
- Set Fields = Nothing
- Set objMessage = Nothing
- Set objConfig = Nothing