<% Option Explicit %> <% Function FormatEmail(n, a) If n <> "" And a <> "" Then FormatEmail = """" & n & """ <" & a & ">" Else FormatEmail = a End If End Function Function SendMail(mFromName, mFromEmail, mToName, mToEmail, mCcName, mCcEmail, mBccName, mBccEmail, mSubject, mBody, mAttachment) SendMail = False On Error Resume Next Dim objMsg, mFrom, mTo, mCc, mBcc, mServer, mPort, mTimeout, mUser, mPass, mSSL If mFromEmail = "" Then Exit Function Else mFrom = FormatEmail(mFromName, mFromEmail) End If If mToName = "" Then Exit Function Else mTo = FormatEmail(mToName, mToEmail) End If mCc = FormatEmail(mCcName, mCcEmail) mBcc = FormatEmail(mBccName, mBccEmail) mServer = "" mPort = 25 mSSL = False mTimeOut = 20 mUser = "" mPass = "" If mFrom = "" Or mTo = "" Then Exit Function Set objMsg = CreateObject("CDO.Message") objMsg.From = mFrom 'objMsg.Sender = mFrom objMsg.To = mTo If mCc <> "" Then objMsg.Cc = mCc If mBcc <> "" Then objMsg.Bcc = mBcc objMsg.Subject = mSubject If mBody <> "" Then If Left(mBody, 1) = "<" Then objMsg.HTMLBody = mBody Else objMsg.TextBody = mBody End If End If If mAttachment <> "" Then objMsg.Addattachment mAttachment If mServer = "" Then ' Send using local SMTP service pickup directory objMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1 Else ' Send using SMTP over network to remote server objMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ' Host name or IP address of remote SMTP server objMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = mServer ' Server port (usually 25) objMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = mPort ' Connection Timeout in seconds objMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = mTimeOut ' Use SSL for the connection (True or False) objMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = mSSL If mUser <> "" And mPass <> "" Then ' Authentication - (0 = NONE, 1 = Basic (Base64 encoded), 2 = NTLM) objMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 ' UserID on the SMTP server used for authentication objMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = mUser ' Password on the SMTP server used for authentication objMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = mPass Else ' Authentication - (0 = NONE, 1 = Basic (Base64 encoded), 2 = NTLM) objMsg.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0 End If End If objMsg.Configuration.Fields.Update objMsg.Send Set objMsg = Nothing If Err.Number = 0 Then SendMail = True End Function Dim Firstname, Company, Email, Question, FormError, Thankyou Firstname = Trim(Request.Form("Firstname")) Company = Trim(Request.Form("Company")) Email = Trim(Request.Form("Email")) Question = Trim(Request.Form("Question")) FormError = "Form" Thankyou = "" If Firstname = "" Then FormError = FormError & ", Name" If Email = "" Then FormError = FormError & ", E-Mail" If Question = "" Then FormError = FormError & ", Question" If FormError = "Form, Name, E-Mail, Question" Then FormError = "" If Left(FormError, 4) = "Form" Then FormError = Mid(FormError, 7) If FormError = "" Then If Company = "" Then Company = "Not provided" If SendMail(Firstname, Email, "Steve", "steve@decorativepaintfinishes.co.uk", "", "", "", "", "Website Form Message", "Name: " & Firstname & vbCrLf & "Company: " & Company & vbCrLf & "E-Mail: " & Email & vbCrLf & "Question..." & vbCrLf & Question & vbCrLf & vbCrLf & "Time: " & Now() & vbCrLf & "Client IP: " & Request.ServerVariables("REMOTE_HOST"), "") Then FormError = "Your message has been sent.

You should receive a response soon." Thankyou = "Thank You" Else FormError = "There was a problem sending the message.

Please telephone 01257 410414 for assistance." Thankyou = "Message Not Sent" End If Else FormError = "Please complete the field(s): " & FormError End If Else Question = "Comments or questions here" End If %> decorative paint finishes marbling graining trompe l'oeil UK Lancashire

Stephen Farnworth


18 Queens Grove
Chorley
Lancashire
PR7 1JX
UK

Telephone: 01257 410414


Mobile: 07890 198463



Email:

steve@decorativepaintfinishes.co.uk
<% If Thankyou = "" Then %>

Enquiry Form

<% If FormError <> "" Then %> <% End If %>
<%= FormError %>
Name :
Company :
E-Mail :
Question :

<% Else %>

<%= Thankyou %>

Name: <%= Firstname %>
Company: <%= Company %>
E-Mail: <%= Email %>
Question: <%= Question %>

<%= FormError %>

<% End If %>