%@LANGUAGE = "VBSCRIPT"%>
<%
' ================== ACADEMY FORMS v. 0.1 ===============
DateTime = Now() 'Store current time as variable
%>
Printers in Accrington, Printers in Blackburn, Printers in Burnley, Printers in Preston, Printers in Lancashire
<%
If Request.Querystring("send") = "True" Then
fmFromname = Trim(Request.Form("fmFromName"))
fmPosition = Trim(Request.Form("fmPosition"))
fmCo = Trim(Request.Form("fmCo"))
fmAddress1 = Trim(Request.Form("fmAddress1"))
fmAddress2 = Trim(Request.Form("fmAddress2"))
fmPCode = Trim(Request.Form("fmPCode"))
fmFrom = Trim(Request.Form("fmFrom"))
fmPhone = Trim(Request.Form("fmPhone"))
fmFax = Trim(Request.Form("fmFax"))
fmDescription = Trim(Request.Form("fmDescription"))
Call SendMail(fmFromname,fmPosition,fmCo,fmAddress1,fmAddress2,fmPCode,fmFrom,fmPhone,fmFax,fmDescription)
Else
Response.Write("Please complete the form below to request a logo design. Fields with an asterisk are required.")
End If
%>
<%
'Begin Routine to Send Mail
Sub SendMail(smFromname,smPosition,smCo,smAddress1,smAddress2,smPCode,smFrom,smPhone,smFax,smDescription)
On Error Resume Next 'To catch any potential errors in the sending
strErr = "" 'Init variable to store any error message
If Len(smPhone) < 5 then
strErr = "Phone Number Required!"
End If
If Len(smFrom) < 5 then
strErr = "Email Address Required!"
End If
'force the carbon copy field to be empty
If Len(smCC) > 0 Then
smCC = ""
End If
'edit from line to include Name Company Phone and Email
smEmail = smFrom
If Len(smFromName) > 0 Then
smFrom = "From: " & smFromName & "<" & smFrom & ">"
End If
'edit subject line to read Price Request (from Academy Website)
smSubject = "General Enquiry for Company: " & fmCo & " (from Academy Website Enquiry Form)"
'edit main message to include all form input fields
smBody = ("General Enquiry Name: " & smFromname & " Position: " & smPosition & " Company: " & smCo & " Address: " & smAddress1 & ", " & smAddress2 & ", " & smPCode & " Email Address: " & smEmail & " Phone: " & smPhone & " Fax: " & smFax & " Description: " & smDescription)
smTo = "info@academy-print.co.uk"
If strErr = "" Then 'If form data has passed basic validation then send
Set iMsg = CreateObject("CDO.Message")
With iMsg
.To = smTo
.From = smFrom
.Subject = smSubject
.HTMLBody = smBody
.Send
End With
'Clean Up
Set iMsg = Nothing
If Err > 0 Then 'If a server/component error occurred
Response.Write("Mail Not Sent! Please try again or resort to email. Error(s) Occurred:")
Response.Write("
" & Err.Description & "
")
Else 'Success! Message Sent
Response.Write("Thank You, your enquiry details have been sent. We will contact you soon. To: " & smTo & " on " & FormatDateTime(DateTime,vbLongDate) & " at " & FormatDateTime(DateTime,vbLongTime))
smTo = ""
smFrom = ""
smCC = ""
smSubject = ""
smBody = ""
smFromname = ""
smPosition = ""
smCo = ""
smAddress1 = ""
smAddress2 = ""
smPCode = ""
smPhone = ""
smFax = ""
smDescription = ""
End If
Else 'Else, Form data incorrect - write out the error(s)
Response.Write("Price Request Details Not Sent! Error(s) Occurred:")
Response.Write("