Hi I have an off site exchange server that is setup using a http proxy can I amend the following code to send e-mail using this exchange server?
Code:
dim msgTo, msgFrom, sMailServerName, msgTxt, msgAttPath
'set data for msg
msgTo = "test.mail@domain.com" 'test@qwerty.com"
msgFrom = "test.mail@domain.com" '"mail@zxcvbn.com.au"
msgSubject = "Test message of VBScript"
msgTxt = "test #1" & vbcrlf & "cdo send"
msgAttPath = ""
SendMail msgFrom, msgTo, msgSubject, msgTxt, msgAttPath
wscript.quit
Sub SendMail ( sFrom, sTo, sSubject, sBody, sAttachPath)
'allocate variables
Dim cdoSendUsingPort, cdoAnonymous,cdoDSNSuccessFailOrDelay
dim objMsg, objConf
dim tcSubject, lcAttName
'set constants as VBS doesnt get from Object
cdoSendUsingPort = 2
cdoAnonymous = 0
cdoDSNSuccessFailOrDelay=14
'set server data
sMailServerName = "exchangeserver" 'exch.qwertyx.com.
Set objConf = CreateObject("CDO.Configuration")
With objConf.fields
.item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = cdoSendUsingPort
.item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = sMailServerName
.item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")[/URL] = cdoAnonymous 'cdoBasic
'.item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusername")[/URL] = "test.mail@domain.com"
'item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendpassword")[/URL] = "password"
.Update
End With
Set objMsg = CreateObject("CDO.Message")
objMsg.Configuration = objConf
With objMsg
.to = sTo
.From = sFrom
.Subject = sSubject & " "
.TextBody = sBody
'use .HTMLBody to send HTML email.
if sAttachPath <> "" then
.AddAttachment sAttachPath
end if
.fields("urn:schemas:mailheader:disposition-notification-to") = sFrom
.fields("urn:schemas:mailheader:return-receipt-to") = sFrom
.DSNOptions = cdoDSNSuccessFailOrDelay
.fields.Update
.Send
End With
set objConf = Nothing
Set objMsg = Nothing
END SUB