<%
Function RequestBrochure()
Const ERR_NOADDRESS = "message.asp?type=e&title=Missing Information&msg=Please provide your name and address, and try again."
Const INF_PLACED = "message.asp?type=i&title=Thank you!&msg=Thanks for requesting our brochure. You should receive a confirmation in your inbox if you entered your email."
Const ERR_EMAIL = "message.asp?type=e&title=Email Problem&msg=Something went wrong when we attempted to email you. Please try again, or email us on info@kavanaghhouse.co.nz for further assistance."
Dim rsML, strQ, i, strEMail
Dim strName, strAddress, strPhone
strName = Trim(Request.Form("txtName"))
strAddress = Trim(Request.Form("txtAddress"))
strPhone = Trim(Request.Form("txtPhone"))
If len(strName) = 0 or len(strAddress) = 0 Then
Response.Redirect ERR_NOADDRESS
Exit Function
End If
strEMail = Trim(Request.Form("txtEMail"))
If Not mailIsAddressValid(strEMail) Then Exit Function
Dim strAuthKey, strErr, strRemAddr, strURL, strMsg, strMsgRequest
strRemAddr = Request.ServerVariables("REMOTE_ADDR")
strURL = "www.kavanaghhouse.co.nz"
strMsg = "
Thank you for requesting the brochure. We will send it out as soon as we can.
" & _
"
This email was sent automatically in response to a request made on our web site." & vbCrLf & "If you did not visit the " & strURL & " site and " & vbCrLf & "request this email, please let us know.
"
strMsgRequest = "The following brochure request has been placed
Name: " & strName & "
Address: " & strAddress & "
The rest of their details have been added to the database if the entered them."
strMsgRequest = mailMakeHtml(strMsgRequest)
strMsg = mailMakeHtml(strMsg)
'to, from, subject, msg, html(y/n), log
call mailSend(EA_COMPETITION, strEMail, "Kavanagh House - Brochure Request Received", strMsg, True, "BROCHURE REQUEST")
call mailsend(EA_COMPETITION, EA_COMPETITION, "Brochure Request From Website", strMsgRequest, True, "BROCHURE REQUEST")
strQ = "INSERT INTO brochure (Name, Email, Address, Phone) VALUES ('" & _
SQLSafe(strName) & "','" & SQLSafe(strEmail) & "','" & SQLSafe(strAddress) & "','" & _
SQLSafe(strPhone) & "')"
Call dbExecute(rsML, strQ)
Response.Redirect INF_PLACED
End Function
%>
<%
call dbClose()
%>