Folks,
I am attempting to send email via SMTP, not Outlook. I still can't get a simple message sent.
The message I usually get (depending on the parameters I change) is:
"The transport failed to connect to the server".
Can some of you eyeball this code and see where they may be a problem:
I am attempting to send email via SMTP, not Outlook. I still can't get a simple message sent.
The message I usually get (depending on the parameters I change) is:
"The transport failed to connect to the server".
Can some of you eyeball this code and see where they may be a problem:
Dim objCDOConfig As Object, objCDOMessage As Object
Dim strSch As String
strSch = "http://schemas.microsoft.com/cdo/configuration/"
Set objCDOConfig = CreateObject("CDO.Configuration")
With objCDOConfig.Fields
.Item(strSch & "sendusing") = 2 ' Send message SMTP over the network
.Item(strSch & "smtpserver") = "smtp.nnnnn.gov"
.Item(strSch & "smtpserverport") = 25
.Item(strSch & "smtpauthenticate") = 1 'yes, authenticate
'.Item(strSch & "sendusername") = "aaa\bbbb"
'.Item(strSch & "sendpassword") = "kkkkklll"
.Item(strSch & "smtpconnectiontimeout") = 60
.Update
End With
Set objCDOMessage = CreateObject("CDO.Message")
With objCDOMessage
Set .Configuration = objCDOConfig
.Subject = "Sample CDO Message"
.from = "wein@nnnnn.gov"
.To = "wein@nnnnn.gov"
.TextBody = "This is a test for CDO message"
.Send
End With
Set objCDOMessage = Nothing
Set objCDOConfig = Nothing
End Sub
Dim strSch As String
strSch = "http://schemas.microsoft.com/cdo/configuration/"
Set objCDOConfig = CreateObject("CDO.Configuration")
With objCDOConfig.Fields
.Item(strSch & "sendusing") = 2 ' Send message SMTP over the network
.Item(strSch & "smtpserver") = "smtp.nnnnn.gov"
.Item(strSch & "smtpserverport") = 25
.Item(strSch & "smtpauthenticate") = 1 'yes, authenticate
'.Item(strSch & "sendusername") = "aaa\bbbb"
'.Item(strSch & "sendpassword") = "kkkkklll"
.Item(strSch & "smtpconnectiontimeout") = 60
.Update
End With
Set objCDOMessage = CreateObject("CDO.Message")
With objCDOMessage
Set .Configuration = objCDOConfig
.Subject = "Sample CDO Message"
.from = "wein@nnnnn.gov"
.To = "wein@nnnnn.gov"
.TextBody = "This is a test for CDO message"
.Send
End With
Set objCDOMessage = Nothing
Set objCDOConfig = Nothing
End Sub