It is asp mail. In the end the gits didn't tell me that a page to do
this had already been written with text formatting and everything. I've
attached it below to help anyone else who may have the same problem as
me..
<%
if (Session("LoggedIn")<>"yes") then
response.redirect "adminlogin.htm"
end if
response.expires=-1000
function GetCountry(sCountryCode)
if (sCountryCode="040") then
GetCountry = "Austria"
elseif (sCountryCode="056") then
GetCountry = "Belgium"
elseif (sCountryCode="208") then
GetCountry = "Denmark"
elseif (sCountryCode="246") then
GetCountry = "Finland"
elseif (sCountryCode="250") then
GetCountry = "France"
elseif (sCountryCode="276") then
GetCountry = "Germany"
elseif (sCountryCode="528") then
GetCountry = "Holland (The Netherlands)"
elseif (sCountryCode="372") then
GetCountry = "Ireland"
elseif (sCountryCode="380") then
GetCountry = "Italy"
elseif (sCountryCode="442") then
GetCountry = "Luxembourg"
elseif (sCountryCode="578") then
GetCountry = "Norway"
elseif (sCountryCode="724") then
GetCountry = "Spain"
elseif (sCountryCode="752") then
GetCountry = "Sweden"
elseif (sCountryCode="756") then
GetCountry = "Switzerland"
elseif (sCountryCode="826") then
GetCountry = "United Kingdom"
end if
end function
sOID = request.querystring("OID")
set cnDB=server.createobject("adodb.connection")
set rsDB=server.createobject("adodb.recordset")
set rsDB2=server.createobject("adodb.recordset")
cnDB.open "etc", "etc", "etc"
sSQL="UPDATE Orders SET transactionstatus='Confirmed' WHERE OID=" & sOID
cnDB.execute sSQL
sSQL="SELECT * FROM Orders WHERE OID=" & sOID
rsDB.open sSQL, cnDB
if (rsDB.EOF=false) then
sbody = "Please do not reply to this email" & vbCrLf & vbCrLf
sbody = sbody & "Thank you for ordering online at blah" & vbCrLf &
vbCrLf
sbody = sbody & "Below is a copy of your order. If you have any
queries regarding your order please contact us using any of the contact
means listed on our website." & vbCrLf & vbCrLf
sbody = sbody & "Your Details" & vbCrLf
sbody = sbody & "------------" & vbCrLf & vbCrLf
sbody = sbody & "Firstname " & rsDB("firstname") & vbCrLf
sbody = sbody & "Surname " & rsDB("surname") & vbCrLf
sbody = sbody & "Address " & rsDB("baddr1") & vbCrLf
if (rsDB("baddr2")<>"") then
sbody = sbody & " " & rsDB("baddr2") & vbCrLf
end if
if (rsDB("baddr3")<>"") then
sbody = sbody & " " & rsDB("baddr3") & vbCrLf
end if
sbody = sbody & " " & rsDB("bcity") & vbCrLf
sbody = sbody & " " & rsDB("bcountyprovince") & vbCrLf
sbody = sbody & " " & GetCountry(rsDB("bcountry")) &
vbCrLf
sbody = sbody & "Postcode " & rsDB("bpostalcode") & vbCrLf
sbody = sbody & "Telephone " & rsDB("btelephonenumber") & vbCrLf
sbody = sbody & "Email " & rsDB("email") & vbCrLf & vbCrLf
sbody = sbody & "Your Order" & vbCrLf
sbody = sbody & "----------" & vbCrLf
sbody = sbody & "Invoice E" & sOID & vbCrLf
sbody = sbody & "Date " & rsDB("EntryDate") & vbCrLf & vbCrLf
sbody = sbody & "Del. Address " & rsDB("saddr1") & vbCrLf
if (rsDB("saddr2")<>"") then
sbody = sbody & " " & rsDB("saddr2") & vbCrLf
end if
if (rsDB("saddr3")<>"") then
sbody = sbody & " " & rsDB("saddr3") & vbCrLf
end if
sbody = sbody & " " & rsDB("scity") & vbCrLf
sbody = sbody & " " & rsDB("scountyprovince") & vbCrLf
sbody = sbody & " " & GetCountry(rsDB("scountry")) &
vbCrLf
sbody = sbody & "Postcode " & rsDB("spostalcode") & vbCrLf
sbody = sbody & "Telephone " & rsDB("stelephonenumber") & vbCrLf &
vbCrLf
sbody = sbody & "Product Price Quantity
Total Price" & vbCrLf
sbody = sbody &
"---------------------------------------------------------------" &
vbCrLf
dTotalPrice=0.0
sSQL = "SELECT * FROM ShoppingBasket WHERE BasketID=" & sOID & " ORDER
BY EntryDate DESC;"
rsDB2.open sSQL, cnDB
do while (rsDB2.EOF=false)
sbody = sbody & left(rsDB2("ProductName") & " - " & rsDB2("SubCode")
& " ", 30)
sbody = sbody & right(" " & FormatCurrency(rsDB2("Price")),
10) & right(" " & rsDB2("Quantity"), 8)
sbody = sbody & right (" " &
FormatCurrency(rsDB2("Price") * rsDB2("Quantity")), 15) & vbCrLf
dTotalPrice=dTotalPrice + (rsDB2("Price") * rsDB2("Quantity"))
rsDB2.MoveNext
loop
rsDB2.close
sbody = sbody &
"---------------------------------------------------------------" &
vbCrLf
sbody = sbody & " Nett Total
" & right(" " & FormatCurrency(dTotalPrice), 10) & vbCrLf
sbody = sbody & " Carriage
" & right(" £" & rsDB("delivery"), 10) & vbCrLf
sbody = sbody & " VAT
" & right(" £" & rsDB("vat"), 10) & vbCrLf
sbody = sbody & " Total
" & right(" £" & rsDB("total"), 10) & vbCrLf & vbCrLf & vbCrLf
sbody = sbody & "This email does not constitute an order until payment
has been received." & vbCrLf & vbCrLf
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "blah"
Mailer.FromAddress= "blah"
Mailer.RemoteHost = "blah"
Mailer.AddRecipient rsDB("firstname") & " " & rsDB("surname"),
rsDB("email")
Mailer.Subject = "product order"
Mailer.BodyText = sBody
Mailer.SendMail
Set Mailer = Nothing
end if
rsDB.close
set rsDB=Nothing
set rsDB2=Nothing
cnDB.close
set cnDB=nothing
response.redirect "adminorders.asp"
%>
Many thanks for your interest,
Richard