%
'check for form posting
bSent = Request("formSent")
If bSent = "True" Then
' process the form
bError = ""
tBody = ""
For Each item In Request.Form
'add text to mail body
tBody = tBody & item & " - " & request.Form(item) & vbcrlf
If Left(item,1) = "X" Then
'check for a value
If Trim(Request.Form(item)) = "" Then
'an obligatory field is empty
bError = "The textbox " & replace(item,"_"," ") & " needs to be entered. Please try again"
End If
End If
Next
If bError = "" Then
'OK to post
Set myMail = Server.CreateObject("CDONTS.NewMail")
myMail.From = "enquiries@cmsols.co.uk"
myMail.To = "enquiries@cmsols.co.uk"
myMail.Body = tBody
myMail.Subject = "Online Enquiry"
myMail.Send()
response.redirect("cms_thankyou.asp")
End If
End If
%>