F
Fox
Can anyone tell me why I might be getting a 500 error
trying to use this VBS template in ASP? The only thing
I could see to do to make it work in ASP was to
add Server.CreateObject instead of CreateObject.
But, obviously there is something more. Are the WITH
statements ok or do they need to be changed ?
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Const cdoSendUsingPickup = 1
set iMsg = Server.CreateObject("CDO.Message")
set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item("sendusing") = cdoSendUsingPickup
' TODO: Replace <PICKUP DIRECTORY> with path to your pickup directory
' Typically, c:\Inetpub\mailroot\pickup
.Item("smtpserverpickupdirectory")= "c:\Inetpub\mailroot\pickup"
.Update
End With
' Build HTML for message body.
strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"
Dim iBP
With iMsg
Set .Configuration = iConf
.To = "(e-mail address removed)"
.From = "(e-mail address removed)"
.Subject = "This is a test CDOSYS message (Sent via Pickup)"
.HTMLBody = strHTML
'TODO: if adding an attachment,
'uncomment the next line and alter file path as required
'Set iBP = iMsg.AddAttachment(App.Path & "\file1.txt")
.Send
End With
' Clean up variables.
Set iBP = Nothing
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
trying to use this VBS template in ASP? The only thing
I could see to do to make it work in ASP was to
add Server.CreateObject instead of CreateObject.
But, obviously there is something more. Are the WITH
statements ok or do they need to be changed ?
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Const cdoSendUsingPickup = 1
set iMsg = Server.CreateObject("CDO.Message")
set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item("sendusing") = cdoSendUsingPickup
' TODO: Replace <PICKUP DIRECTORY> with path to your pickup directory
' Typically, c:\Inetpub\mailroot\pickup
.Item("smtpserverpickupdirectory")= "c:\Inetpub\mailroot\pickup"
.Update
End With
' Build HTML for message body.
strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"
Dim iBP
With iMsg
Set .Configuration = iConf
.To = "(e-mail address removed)"
.From = "(e-mail address removed)"
.Subject = "This is a test CDOSYS message (Sent via Pickup)"
.HTMLBody = strHTML
'TODO: if adding an attachment,
'uncomment the next line and alter file path as required
'Set iBP = iMsg.AddAttachment(App.Path & "\file1.txt")
.Send
End With
' Clean up variables.
Set iBP = Nothing
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing