<% Option Explicit %> Net Languages
 
 
<% function sendEmail(emailTo,from,subject,body) sendEmail = "" dim oMail Set oMail = CreateObject("CDO.Message") oMail.To = emailTo oMail.From = "website@netlanguages.com" oMail.ReplyTo = from oMail.Cc = from if Request.QueryString("lang") = "es" then oMail.Bcc = "andy@netlanguages.com;isabel@netlanguages.com" else oMail.Bcc = "andy@netlanguages.com;fiona@netlanguages.com" end if oMail.Subject = subject oMail.TextBody = body oMail.Send Set oMail = nothing end function function checkFormItems() checkFormItems = "" if student_name = "" then checkFormItems = checkFormItems & "
  • error_student_name
  • " if student_email = "" then checkFormItems = checkFormItems & "
  • error_student_email
  • " if tutor_email = "" then checkFormItems = checkFormItems & "
  • error_tutor_email
  • " if subject = "" then checkFormItems = checkFormItems & "
  • error_subject
  • " if score = "" then checkFormItems = checkFormItems & "
  • error_score
  • " end function dim student_name,student_email,tutor_email,score,subject,body dim formErrors student_name = trim(Request.Form("student_name")) student_email = trim(Request.Form("student_email")) tutor_email = trim(Request.Form("tutor_email")) score = trim(Request.Form("score")) subject = trim(Request.Form("subject")) body = "" formErrors = checkFormItems if formErrors <> "" then if Request.QueryString("lang") = "es" then ' spanish errors formErrors = replace(formErrors,"error_student_name","Falta su nombre") formErrors = replace(formErrors,"error_student_email","Falta su dirección de correo electrónico") formErrors = replace(formErrors,"error_tutor_email","Falta la dirección de correo electrónico de su tutor") formErrors = replace(formErrors,"error_subject","Falta el nombre del curso") formErrors = replace(formErrors,"error_score","Falta el resultado del test") else ' english errors formErrors = replace(formErrors,"error_student_name","Your name is empty") formErrors = replace(formErrors,"error_student_email","Your email address is empty") formErrors = replace(formErrors,"error_tutor_email","Your tutor's email address is empty") formErrors = replace(formErrors,"error_subject","The name of the course is empty") formErrors = replace(formErrors,"error_score","The result of the test is empty") end if else if Request.QueryString("lang") = "es" then body = subject & vbCRLF & _ "===================================" & vbCRLF & _ vbCRLF & _ "Nombre: " & student_name & vbCRLF & _ "Email: " & student_email & vbCRLF & _ "Resultado: " & score & vbCRLF & _ "===================================" else body = subject & vbCRLF & _ "===================================" & vbCRLF & _ vbCRLF & _ "Name: " & student_name & vbCRLF & _ "Email: " & student_email & vbCRLF & _ "Score: " & score & vbCRLF & _ "===================================" end if formErrors = sendEmail(tutor_email,student_email,"[NL-website] " & subject,body) end if if formErrors <> "" then %> <% if Request.QueryString("lang") = "es" then %>

    Han occurido error(es):

      <%=formErrors%>

    Por favor, intentar de nuevo.

     

    <% else %>

    Error(s) have occured:

      <%=formErrors%>

    Please try again.

     

    <% end if %> <% else %> <% if Request.QueryString("lang") = "es" then %>

    Gracias por realizar el test.

    Recibirá un correo electrónico con sus resultados.

     

    <% else %>

    Thank you for completing the test.

    You will receive an email with your results.

     

    <% end if %> <% end if %>
     
    © Net Languages 1998 - <%=year(now)%>