<% Dim strtxtName, strAddress, strCity, strState, strZip, strCountry, strTelephone, strFax, strToEmail, strQuestions Dim strSubject, strBody Dim objCDOMail 'Read in the values entered strName = Request.Form("txtName") strAddress = Request.Form("txtAddress") strCity = Request.Form("txtCity") strState = Request.Form("txtState") strZip = Request.Form("txtZip") strCountry = Request.Form("txtCountry") strTelephone = Request.Form("txtPhone") strFax = Request.Form("txtFax") strToEmail = Request.Form("txtEmail") strQuestions = Request.Form("txtQuestions") ' Both of these should be changed before you run this script. strSubject = "Contact Us" ' This is multi-lined simply for readability strBody = "Name: " & strName & vbCrLf strBody = strBody & "Address: " & strAddress & vbCrLf strBody = strBody & "City: " & strCity & vbCrLf strBody = strBody & "State: " & strState & vbCrLf strBody = strBody & "Zip: " & strZip & vbCrLf strBody = strBody & "Country: " & strCountry & vbCrLf strBody = strBody & "Telephone: " & strTelephone & vbCrLf strBody = strBody & "Fax: " & strFax & vbCrLf strBody = strBody & "Email: " & strToEmail & vbCrLf strBody = strBody & "Question: " & strQuestions & vbCrLf strBody = strBody & vbCrLf If strToEmail = "" Or Not IsValidEmail(strToEmail) Then %>

Contact Us...

Fields Marked with * are required

Name*
Mailing Address City State Zip
Country Telephone* Fax Email*
Questions or requested information:

<% Else Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing" Const cdoSendUsingPort = 2 Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver" Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport" Const cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout" Dim objConfig ' As CDO.Configuration Dim objMessage ' As CDO.Message Dim Fields ' As ADODB.Fields ' Get a handle on the config object and it's fields Set objConfig = Server.CreateObject("CDO.Configuration") Set Fields = objConfig.Fields ' Set config fields we care about With Fields .Item(cdoSendUsingMethod) = cdoSendUsingPort .Item(cdoSMTPServer) = "nwn.nuwavenet.com" .Item(cdoSMTPServerPort) = 25 .Item(cdoSMTPConnectionTimeout) = 10 .Update End With Set objMessage = Server.CreateObject("CDO.Message") Set objMessage.Configuration = objConfig With objMessage .To = "chlabelco@aol.com" .From = "sales@chlabel.com" .Subject = strSubject .TextBody = strBody .Send End With Set Fields = Nothing Set objMessage = Nothing Set objConfig = Nothing Response.Redirect "ContactUs.asp" End If ' Only functions and subs follow! ' A quick email syntax checker. It's not perfect, ' but it's quick and easy and will catch most of ' the bad addresses than people type in. Function IsValidEmail(strEmail) Dim bIsValid bIsValid = True If Len(strEmail) < 5 Then bIsValid = False Else If Instr(1, strEmail, " ") <> 0 Then bIsValid = False Else If InStr(1, strEmail, "@", 1) < 2 Then bIsValid = False Else If InStrRev(strEmail, ".") < InStr(1, strEmail, "@", 1) + 2 Then bIsValid = False End If End If End If End If IsValidEmail = bIsValid End Function %>


 

C & H Label Company Inc.
6928 S. R.L. Thornton Freeway
Dallas, Texas 75232
Office: (214) 371-2355
Fax: (214) 371-0050

 

© Copyright 2000-2006