% Dim strtxtName, strOrg, strAddress, strCity, strState, strZip, strCountry, strTelephone, strFax, strToEmail Dim strWidth, strLength, strShape, strMaterial, strAdhesive, strProtective, strApplied, strApplication, strImprint, strNoColors, strFinishing Dim strSubject, strBody Dim objCDOMail 'Read in the values entered strName = Request.Form("txtName") strOrg = Request.Form("txtOrg") strAddress = Request.Form("txtAddress") strCity = Request.Form("txtCity") strState = Request.Form("txtState") strZip = Request.Form("txtZip") strCountry = Request.Form("txtCountry") strTelephone = Request.Form("txtTelephone") strFax = Request.Form("txtFax") strToEmail = Request.Form("txtEmail") strWidth = Request.Form("txtWidth") strLength = Request.Form("txtLength") strShape = Request.Form("cboShape") strMaterial = Request.Form("cboMaterial") strAdhesive = Request.Form("cboAdhesive") strProtective = Request.Form("cboProtective") strApplied = Request.Form("cboApplied") strApplication = Request.Form("cboApplication") strImprint = Request.Form("cboImprint") strNoColors = Request.Form("cboNoColors") strFinishing = Request.Form("cboFinishing") ' Both of these should be changed before you run this script. strSubject = "Online Quote" ' This is multi-lined simply for readability strBody = "Name: " & strName & vbCrLf strBody = strBody & "Agency\Organization: " & strOrg & 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 & "Width: " & strWidth & vbCrLf strBody = strBody & "Length: " & strLength & vbCrLf strBody = strBody & "Shape: " & strShape & vbCrLf strBody = strBody & "Material: " & strMaterial & vbCrLf strBody = strBody & "Adhesive: " & strAdhesive & vbCrLf strBody = strBody & "Protective: " & strProtective & vbCrLf strBody = strBody & "Applied: " & strApplied & vbCrLf strBody = strBody & "Application: " & strApplication & vbCrLf strBody = strBody & "Imprint: " & strImprint & vbCrLf strBody = strBody & "Number of Colors: " & strNoColors & vbCrLf strBody = strBody & "Finishing: " & strFinishing & vbCrLf strBody = strBody & vbCrLf 'Ok we've got the values now on to the point of the script. 'We just check to see if someone has entered anything into the to field. 'If it's equal to nothing we show the form, otherwise we send the message. 'If you were doing this for real you might want to check other fields too 'and do a little entry validation like checking for valid syntax etc. ' Note: I was getting so many bad addresses being entered and bounced ' back to me by mailservers that I've added a quick validation routine. If strToEmail = "" Or Not IsValidEmail(strToEmail) Then %>
<% 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 "QuoteForm.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 |