![]() |
|
|
<%
'*******************************************************
'* 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. *
'* *
'* Please direct all inquiries to webmaster@asp101.com *
'*******************************************************
%>
<%
Dim strTo, strSubject, strBody 'Strings for recipient, subject, body
Dim objCDOMail 'The CDO object
'First we'll read in the values entered
strTo = Request.Form("to")
'These would read the message subject and body if we let you enter it
strSubject = Request.Form("subject")
strBody = Request.Form("body")
strBody = strBody & vbCrLf & vbCrLf
strBody = strBody & Request.Form("appointment")
strBody = strBody & vbCrLf & vbCrLf
strBody = strBody & "--"
strBody = strBody & vbCrLf
strBody = strBody & Request.Form("name")
strBody = strBody & vbCrLf
strBody = strBody & Request.Form("email")
strBody = strBody & vbCrLf
strBody = strBody & Request.Form("address")
strBody = strBody & vbCrLf
strBody = strBody & Request.Form("city") & Request.Form("state") & Request.Form("zip")
strBody = strBody & vbCrLf
strBody = strBody & Request.Form("phone_area")-Request.Form("phone_number")
strBody = strBody & vbCrLf
strBody = strBody & Request.Form("comments")
strBody = strBody & vbCrLf
strBody = strBody & "--"
strBody = strBody & vbCrLf
strBody = strBody & "APPOINTMENT:"
strBody = strBody & Request.Form("weekday")
strBody = strBody & vbCrLf
strBody = strBody & Request.Form("daytime")
strBody = strBody & vbCrLf
If strTo = "" Or Not IsValidEmail(strTo) Then
%>
<%
Else
' Create an instance of the NewMail object.
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
' Set the properties of the object
'***********************************************************
' PLEASE CHANGE THESE SO WE DON'T APPEAR TO BE SENDING YOUR
' EMAIL. WE ALSO DON'T WANT THE EMAILS TO GET SENT TO US
' WHEN SOMETHING GOES WRONG WITH YOUR SCRIPT... THANKS
'***********************************************************
objCDOMail.From = "Appointment Your appointment has been successfully sent! " End If ' End page logic %> <% ' 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 %> |
|