<% Dim strInput, strTo, strSubject, strBody, strFrom, errMsg, successMsg, strMessege, strFirstName, strLastName, hidden_value, strResult2, MyFileObj, MyOutStream, strHeader Dim objCDOMail 'The CDO object 'First we'll read in the values entered strFirstName = Ltrim(Rtrim(Request.Form("FirstName"))) strLastName = Ltrim(Rtrim(Request.Form("LastName"))) strInput = Ltrim(Rtrim(Request.Form("Input"))) 'strFrom = Ltrim(Rtrim(Request.Form("From"))) strTo = Ltrim(Rtrim(Request.Form("To"))) strMessege = "Thank you. I've sent you the text via email for this auto generated email response from the e-newsletter signup. At any time you may unsubscribe by sending us an email at " strFlag = Request.Form("flag") 'hidden_value = Request.Form("hidden_value") strName = "Kathmandu Restaurant" strSubject = "Kathmandu Restaurant Auto email response" ' This is multi-lined simply for readability strBody = "Dear Correspondent, Thank you for writing to Kathmandu Restaurant. We value your comments and hope to see you soon." 'strBody = strBody & "" If strFlag = "1" Then 'If IsValidEmail(strFrom) = false Then 'errMsg = errMsg & "
  • Sorry! There was an error in your email address.
    Please check it and enter it again. Thanks!
  • " 'End If If IsValidEmail(strTo) = false Then errMsg = errMsg & "
  • Sorry! There was an error in the email address.
  • " End If If strInput = "" Then errMsg = errMsg & "
  • Sorry! You did not input any message.
  • " End If If errMsg = "" Then 'strResult2 = strTo 'If strFirstName <> "" Then 'strResult2 = strResult2 & "|" & strFirstName 'End If If strFirstName = "" Then strFirstName = "First name undefined" End If 'If strLastName <> "" Then 'strResult2 = strResult2 & "|" & strLastName 'End If If strLastName = "" Then strLastName = "Last name undefined" End If 'strResult2 = strFirstName & "|" & strTo & "|" &hidden_value ' Writing results to the text file 'Set MyFileObj=Server.CreateObject("Scripting.FileSystemObject") 'Writes the results header if first time accessing the file 'If not((MyFileObj.FileExists(devlin))=true) Then 'strHeader = "<" & "%" & vbCrLf & "' " & "Signup Email Address | First name | Last name | Country" 'strHeader = strHeader & vbCrLf & "%" & ">" & vbCrLf ' End If 'Set MyOutStream= MyFileObj.OpenTextFile(devlin, 8, TRUE) 'Writes the line to the file 'If not(strHeader="") Then 'MyOutStream.WriteLine(strHeader) 'End If 'MyOutStream.WriteLine(strResult2 ) 'Closes the file 'MyOutStream.Close ' Create an instance of the NewMail object. Set objCDOMail = Server.CreateObject("CDONTS.NewMail") ' This syntax works fine 'objCDOMail.From = "" ' But this gets you the appearance of a real name! objCDOMail.From = "Kathmandu Restaurant" objCDOMail.To = strTo objCDOMail.Subject = strSubject objCDOMail.Body = strBody ' There are lots of other properties you can use. ' You can send HTML e-mail, attachments, etc... ' You can also modify most aspects of the message ' like importance, custom headers, ... ' Check the documentation for a full list as well ' as the correct syntax. ' Some of the more useful ones I've included samples of here: 'objCDOMail.Cc = ";" 'objCDOMail.Bcc = ";" 'objCDOMail.Importance = 1 '(0=Low, 1=Normal, 2=High) 'objCDOMail.AttachFile "c:\path\filename.txt", "filename.txt" ' I've had several requests for how to send HTML email. ' To do so simply set the body format to HTML and then ' compose your body using standard HTML tags. 'objCDOMail.BodyFormat = 0 ' CdoBodyFormatHTML 'Outlook gives you grief unless you also set: 'objCDOMail.MailFormat = 0 ' CdoMailFormatMime ' THIS LINE SHOULD BE UNCOMMENTED TO ACTUALLY SEND THE ' MESSAGE. PLEASE BE SURE YOU HAVE APPROPRIATE VALUES ' FOR TO AND FROM ADDRESSES AND HAVE CHANGED THE MESSAGE ' SUBJECT AND BODY BEFORE UNCOMMENTING THIS. ' Send the message! objCDOMail.Send ' Set the object to nothing because it immediately becomes ' invalid after calling the Send method. Set objCDOMail = Nothing 'testing 2nd email >>>>>>> strInputFinal = "First name: " & strFirstName & vbCrLf strInputFinal = strInputFinal & "Last name: " & strLastName & vbCrLf strInputFinal = strInputFinal & "Message: " & vbCrLf & strInput & vbCrLf ' Create an instance of the NewMail object. Set objCDOMail = Server.CreateObject("CDONTS.NewMail") ' This syntax works fine 'objCDOMail.From = "" ' But this gets you the appearance of a real name! objCDOMail.From = strTo 'objCDOMail.To = "" objCDOMail.To = "" objCDOMail.Subject = "Message from www.kathmandurestaurant.ca" objCDOMail.Body = strInputFinal ' There are lots of other properties you can use. ' You can send HTML e-mail, attachments, etc... ' You can also modify most aspects of the message ' like importance, custom headers, ... ' Check the documentation for a full list as well ' as the correct syntax. ' Some of the more useful ones I've included samples of here: objCDOMail.Cc = ";" 'objCDOMail.Bcc = ";" 'objCDOMail.Importance = 1 '(0=Low, 1=Normal, 2=High) 'objCDOMail.AttachFile "c:\path\filename.txt", "filename.txt" ' I've had several requests for how to send HTML email. ' To do so simply set the body format to HTML and then ' compose your body using standard HTML tags. 'objCDOMail.BodyFormat = 0 ' CdoBodyFormatHTML 'Outlook gives you grief unless you also set: 'objCDOMail.MailFormat = 0 ' CdoMailFormatMime ' THIS LINE SHOULD BE UNCOMMENTED TO ACTUALLY SEND THE ' MESSAGE. PLEASE BE SURE YOU HAVE APPROPRIATE VALUES ' FOR TO AND FROM ADDRESSES AND HAVE CHANGED THE MESSAGE ' SUBJECT AND BODY BEFORE UNCOMMENTING THIS. ' Send the message! objCDOMail.Send ' Set the object to nothing because it immediately becomes ' invalid after calling the Send method. Set objCDOMail = Nothing 'testing 2nd email end <<<<<<<< 'Response.Write "Message written: " & strResult2 & "!" successMsg = "





    Thank you writing to Kathmandu Restaurant

    Visit us again at www.kathmandurestaurant.ca

    KATHMANDU RESTAURANT
    517 YONGE STREET
    TORONTO, ON, M4Y 1Y3

    (416) 924 5787

    Close This Window

    " End If End If 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 %>
    <% If strFlag = "1" and successMsg <> "" Then %>

    <%= successMsg %> <% Else %>
    <% If errMsg <> "" Then %> <%= errMsg %> <% End If 'If strFlag <> "1" Then 'strTo="enter email address" 'End If %>

    Feedback

    We would love to hear from you!!

    Just fill out the form below and submit with your comments or questions. Thanks.
    * mandatory field
    ** Email Address:  
    First Name:  
    Last Name:  
    ** Message:  


    <% End If %>