Det må være denne her - ikk?
<%
'Start the functions
function SendEmail
'on error resume next 'This code will only work on a Win2k server.
Dim iMsg,iConf,Flds
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
EmailPage="
http://rj/V3/Email.asp?OrderID=" & OrderID & "&CustomerID=" & CustomerID
'Response.Write(EmailPage)
'Response.End()
With Flds
' assume constants are defined within script file
.Item("
http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("
http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
.Update
End With
With iMsg
Set .Configuration = iConf
.To = CustomerRS("CustomerEmail")
.From = "webshop@rjo.dk"
.Subject = "Charon Cart Order"
'.TextBody = "test"
.CreateMHTMLBody cstr(EmailPage)
.Send
End With
end function
function SendCdoEmail
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
dim strBody
objXML.load(Server.MapPath("xml/orders_email.xml"))
set objNodeXML=objXML.documentElement
strFrom=objNodeXML.selectSingleNode("from").Text
strSubject=objNodeXML.selectSingleNode("subject").Text
strBody=objNodeXML.selectSingleNode("body").Text
Set objXML = Nothing
'Response.Write mailbody(strBody)
'response.End()
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.From = strFrom
objCDOMail.To = CustomerRS("CustomerEmail")
objCDOMail.Subject = strSubject
objCDOMail.Body = mailbody(strBody)
objCDOMail.MailFormat=0
objCDOMail.BodyFormat=0
objCDOMail.Send
Set objCDOMail = Nothing
end function
'This function will replace the tokens in the XML file with contents of recordset
function mailbody(c)
tmpStr=c
tmpStr=replace(tmpStr,"#OrderID#",Session("OrderID"))
tmpStr=replace(tmpStr,"#OrderDetails#",OrderDetails)
tmpStr=replace(tmpStr,"#OrderSummary#",OrderSummary)
'Look at this next bit. In the XML file, the tokens are replaced by content from the recordset.
'So, if you've got #FirstName# in the XML file
'it will be replaced by FirstName content of recordset. Neat, eh?
for each fld in CustomerRS.Fields
if CustomerRS(fld.Name) & "" <> "" then
tmpStr=replace(tmpStr,"#" & fld.Name & "#",CustomerRS(fld.Name))
end if
next
mailbody=tmpStr
end function
function OrderDetails
tmpStr=""
while not CustomerOrderRS.eof
tmpStr=tmpStr & "ProductID - " & CustomerOrderRS("ProductID") & "<br>"
tmpStr=tmpStr & "Product - " & CustomerOrderRS("ProductName") & "<br>"
tmpStr=tmpStr & "Size - " & CustomerOrderRS("ProductSize") & "<br>"
tmpStr=tmpStr & "Colour - " & CustomerOrderRS("Colour") & "<br>"
tmpStr=tmpStr & "Quantity - " & CustomerOrderRS("Quantity") & "<br>"
tmpStr=tmpStr & "Unit Price - £" & formatnumber(CustomerOrderRS("UnitPrice"),2) & "<br>"
tmpStr=tmpStr & "==============" & "<br>" & "<br>"
CustomerOrderRS.movenext
wend
CustomerOrderRS.requery
OrderDetails=tmpStr
end function
function OrderSummary
tmpStr=""
tmpStr=tmpStr & "Subtotal - £" & formatnumber(OrdersRS("SubTotal"),2) & "<br>"
tmpStr=tmpStr & "Shipping - £" & formatnumber(OrdersRS("Freight"),2) & "<br>"
tmpStr=tmpStr & "Sales Tax - £" & formatnumber(OrdersRS("SalesTax"),2) & "<br>"
tmpStr=tmpStr & "Grandtotal - £" & formatnumber(OrdersRS("GrandTotal"),2) & "<br>" & "<br>"
OrderSummary=tmpStr
end function
%>