<% ' Declare our variables: Dim objCDO ' Our CDO object Dim strTo ' Strings to hold our email fields Dim strFrom Dim strSubject Dim strBody ' First we'll read in the values entered and set by ' hand the ones we don't let you enter for our demo. strTo = Request.Form("UserEmail") ' These could read the message subject and body in ' from a form just like the "to" field if we let you ' enter them. ' 'strSubject = Request.Form("subject") 'strBody = Request.Form("body") ' ' We instead hard code them below just so people ' don't abuse this page. strFrom = "User Name " strSubject = "Abbey Glass Chester Enquiry Form" ' This is multi-lined simply for readability. ' Notice that it is a properly formatted HTML ' message and not just plain text like most email. ' A lot of people have asked how to use form data ' in the emails so I added an example of including ' the entered address in the body of the email. strBody = "" & vbCrLf _ & "" & vbCrLf _ & "" & vbCrLf _ & " ABBEY GLASS CHESTER" & vbCrLf _ & " " & vbCrLf _ & "" & vbCrLf _ & "" & vbCrLf _ & "

GLASS & GLAZING

" & vbCrLf _ & "

" & vbCrLf _ & " This message has been sent from" & vbCrLf _ & " Abbey Glass Chester." & vbCrLf _ & " Thank you for your enquiry, we will contact" & vbCrLf _ & " you as soon as we can with the information" & vbCrLf _ & " you requested." & vbCrLf _ & "

" & vbCrLf _ & " If you did not request this email yourself," & vbCrLf _ & " your address was entered by one of our" & vbCrLf _ & " visitors." & vbCrLf _ & "

" & vbCrLf _ & "

" & vbCrLf _ & " " & vbCrLf _ & " " & vbCrLf _ & "

This message was sent to: " & strTo & "

" & vbCrLf _ & " " & vbCrLf _ & "" & vbCrLf _ & "" & vbCrLf ' Some lines to help you check the formatting of your ' email before you actually start sending it to people. 'Response.Write "
"
'Response.Write Server.HTMLEncode(strbody)
'Response.Write "
" 'Response.End ' Ok... we've got all our values so let's get emailing: %> <% If Request.Form("SendButton") <> "Submit" Then %>
" onsubmit="return Validator(this)">

Please complete the form below with the
information you require, and we will contact you
as soon as we possibly can.
 

Name  

Company  

Address  

 
 

Post Code  

 

Telephone Number   

 

Email  

 

Information required  

 

Size of glass required   

 
   
 
 
       
 
<% Else Set Message = CreateObject("CDONTS.NewMail") Message.From = Request.Form("UserEmail") Message.To = "david@djfletcher.fsnet.co.uk" Message.Subject = "Abbey Glass Chester Enquiry Form" BodyToSend = "Stored Form Details are as follows" & vbcrlf & vbcrlf BodyToSend = BodyToSend & "Name: " & Request.Form("name")& vbcrlf BodyToSend = BodyToSend & "Company: " & Request.Form("company")& vbcrlf BodyToSend = BodyToSend & "Address: " & Request.Form("addr1")& vbcrlf BodyToSend = BodyToSend & " " & Request.Form("addr2")& vbcrlf BodyToSend = BodyToSend & " " & Request.Form("addr3")& vbcrlf BodyToSend = BodyToSend & "Postcode: " & Request.Form("postcode")& vbcrlf & vbcrlf BodyToSend = BodyToSend & "Telephone: " & Request.Form("phone_no")& vbcrlf BodyToSend = BodyToSend & "Email Address: " & Request.Form("UserEmail")& vbcrlf &vbcrlf BodyToSend = BodyToSend & "Information required: " & Request.Form("Information")& vbcrlf &vbcrlf BodyToSend = BodyToSend & "Glass size: " & Request.Form("Glass_Size")& vbcrlf BodyToSend = BodyToSend & "Size in: " & Request.Form("c1")& vbcrlf &vbcrlf Message.Body = BodyToSend On Error Resume Next Message.Send strFrom = "Abbey Glass Chester " Set objCDO = Server.CreateObject("CDONTS.NewMail") objCDO.From = strFrom objCDO.To = strTo objCDO.Subject = strSubject objCDO.Body = strBody objCDO.BodyFormat = 0 ' CdoBodyFormatHTML ' objCDO.Cc = "David@timelessmemorials.co.uk" objCDO.Bcc = "David_J_Fletcher@msn.com" ' Send the message! objCDO.Send Set objCDO = Nothing Response.Write "Thank you for your enquiry, a representative of Abbey Glass Chester will contact you as soon as possible." end if %>