<% If request.form("btnSubmit") <> "" then
'Declare variables for the e-mail script
dim strAddr
dim replyTo
dim strSubject
dim strText
'Get input from the form and assign it to script variables
strAddr = Trim(Request.form("user_email"))
if strAddr <> "" then
replyTo = cstr(strAddr)
end if
strSubject = Request.form("user_subject")
strName = Request.form("user_name")
strMsg = Request.form("user_text")
strUrl = Request.form("user_url")
strText = "This is an email from www.themonopolypubcrawl.co.uk. & vbCrLf & vbCrLf & E-mail from: " & strName & vbCrLf & vbCrLf & "Concerning: " & strMsg
'Note: use vbCrLf (as above) to add line breaks in the e-mail message
'A real form might check for more blank fields and a valid e-mail address.
'Form has been submitted after JavaScript validation, but if JavaScript off, server also validates
If (replyTo <> "" AND strMsg <> "" AND strName <> "") then
send_email()
else
Response.Write "
Please complete required fields!"
end if
'The send_email function formats and sends the e-mail
function send_email()
'Create an object or container for your mail
Dim objMail
Set objMail = Server.CreateObject("CDO.Message")
'Format the e-mail using fields from your HTML form
objMail.To = "kenwyatt@gmail.com"
objMail.From = strAddr
objMail.ReplyTo = replyTo
objMail.Subject = strSubject
objMail.TextBody = strText
objMail.Send
'Release system resources
Set objMail = Nothing
if err.number > 0 then
response.write "Errors were encountered in sending your e-mail message. "&_
"Please try again, or contact
The Geek"
else
'You could use a JavaScript alert or write a confirmation to the screen. Sample javascript alert is shown in next line.
'Response.Write ""
Response.Write "
Contact us
"
Response.Write "
"
Response.Write ""
end if
end function
else
'display the form
%>
Contact us
Why not send us a chirpy email of encouragement!
Please note, all fields marked with an asterix (*) are compulsory.
<%
end if
%>
Related links
Google Ads