qplogo
 
Web Quantum Petshop
projectstutorialsaboutqpqpstorepressroomcollaborationcontactlinks
<% '******************************************************* '* ASP 101 Sample Code - http://www.asp101.com/ * '* * '* This code is made available as a service to our * '* visitors and is provided strictly for the * '* purpose of illustration. * '* * '* http://www.asp101.com/samples/license.asp * '* * '* Please direct all inquiries to webmaster@asp101.com * '******************************************************* %>

<% Dim objCDONTS ' Email object Dim strFromName ' From persons' real name Dim strFromEmail, strToEmail ' Email addresses Dim strSubject, strBody ' Message Dim bValidInput ' A boolean indicating valid parameters ' Retrieve this page name and referring page name strThisPage = Request.ServerVariables("SCRIPT_NAME") strReferringPage = Request.ServerVariables("HTTP_REFERER") ' Read in and set the initial values of our message parameters strFromName = Trim(Request.Form("txtFromName")) strFromEmail = Trim(Request.Form("txtFromEmail")) strToEmail = Trim(Request.Form("txtToEmail")) & "@" & "quantumpetshop.com" strSubject = "Message from QP Website Contact Form" strBody = Trim(Request.Form("txtMessage")) ' Quick validation just to make sure our parameters are somewhat valid bValidInput = True bValidInput = bValidInput And strFromName <> "" bValidInput = bValidInput And IsValidEmail(strFromEmail) bValidInput = bValidInput And IsValidEmail(strToEmail) ' If valid send email and show thanks, o/w show form If bValidInput Then ' Set up our email object and send the message Set objCDONTS = Server.CreateObject("CDONTS.NewMail") objCDONTS.From = strFromName & " <" & strFromEmail & ">" objCDONTS.To = strToEmail objCDONTS.BCC = "info" & "@" & "quantumpetshop" & "." & "com" objCDONTS.Subject = strSubject objCDONTS.Body = strBody & vbCrLf & vbCrLf & "This e-mail sent from Quantum Petshop's (www.quantumpetshop.com) Contact Form." objCDONTS.Send Set objCDONTS = Nothing ' Show our thank you message ShowThanksMsg Else If "http://" & Request.ServerVariables("HTTP_HOST") & strThisPage = strReferringPage Then Response.Write "

" & "There's been an error. Please check your entries (probable bad e-mail address):" & "
To: " & strToEmail & "
From:" & strFromEmail & "

" & vbCrLf End If ' Show our information retrieval form ShowReferralForm strThisPage, strFromName, strFromEmail, strToEmail, strBody End If ' End of page logic... subs and functions follow! %> <% ' Subroutines and Functions that encapsulate some functionality ' and make the above code easier to write... and read. ' 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 ' I made this a function just to get it out of the ' logic and make it easier to read. It just shows the ' form that asks for the input Sub ShowReferralForm(strThisPage, strFromName, strFromEmail, strToEmail, strBody) ' I use script_name so users can rename this script witout having to change the code. %>

Contact Quantum Petshop

Just put in your name and e-mail (so we can reply back to you). E-mails are not gathered or collected for any purpose.

Your Name:
Your E-mail:
Contact Who :
Message:
  

If you'de rather contact Quantum Petshop directly, please use the following e-mails.

General contact information:

Sales information:

Individual contacts:

Ryan Foss:

Bill Nagel:

Other information:

Quantum Petshop is located in the Minneapolis Minnesota (USA) area. For mailing address, please contact:

<% '

The Message to be sent:

'

Subject: < %= strSubject % >

'

Body: < %= strBody % >

End Sub ' This just shows our thank you message... probably didn't need to ' be a function, but since I made the form one I figured I'd do this ' for consistency. Sub ShowThanksMsg() %>

Thanks for Contacting Quantum Petshop 

<%= strFromName %>, your message has been sent to <%= strToEmail %>.

<% End Sub %>

Found our stuff useful or interesting? Help us function and keep us motivated.




all content © Copyright Quantum Petshop 1998-2006

quantum petshop tresure box
[an error occurred while processing this directive]