<% Dim strCampos, strMsg, strHTML Dim strKey Dim fTot, iCont Dim strReferer, strRefLista Dim recipient Dim recipientcc Dim recipientbcc Dim subject Dim email Dim realname Dim strredirect Dim bgcolor Dim background Dim link_color Dim vlink_color Dim text_color Dim alink_color Dim title Dim sort Dim print_config Dim return_link_title Dim return_link_url Dim sNomeEscola Dim flFaleConoscoInstitucional flFaleConoscoInstitucional="false" strRefLista = "yazigi.com,yazigi.net" strReferer = Request.ServerVariables("HTTP_REFERER") gravalog vbCrLf & String(40,"=") & vbCrLf gravalog "** " & now() & " **" & vbCrLf & vbCrLf gravalog " - REFERER: " & strReferer & vbCrLf & " - HTTP_HEADERS: " & Request.ServerVariables("ALL_HTTP") & vbCrLf gravalog vbCrLf & " - CONTENT_TYPE: " & Request.ServerVariables("CONTENT_TYPE") & vbCrLf gravalog vbCrLf & " - QUERY_STRING: " & Request.ServerVariables("QUERY_STRING") & vbCrLf gravalog vbCrLf & " - REQUEST_METHOD: " & Request.ServerVariables("REQUEST_METHOD") & vbCrLf 'Verifica a URL que acessa esta página 'verificareferer strRefLista, strReferer fTot = Request.Form.Count For iCont = 1 to fTot strKey = "" strKey = Request.Form.Key(iCont) Select case LCASE(strKey) Case "recipient" recipient = Request.Form.Item(iCont) Case "recipientcc" recipientcc = DecodeUTF8(Request.Form.Item(iCont)) Case "recipientbcc" recipientbcc = Request.Form.Item(iCont) Case "subject" subject = Request.Form.Item(iCont) Case "email" email = Request.Form.Item(iCont) Case "realname" realname = request.Form.Item(iCont) Case "redirect" strredirect = Request.Form.Item(iCont) Case "bgcolor" bgcolor = DecodeUTF8(Request.Form.Item(iCont)) Case "background" background = DecodeUTF8(Request.Form.Item(iCont)) Case "link_color" link_color = DecodeUTF8(Request.Form.Item(iCont)) Case "vlink_color" vlink_color = DecodeUTF8(Request.Form.Item(iCont)) Case "text_color" text_color = DecodeUTF8(Request.Form.Item(iCont)) Case "alink_color" alink_color = DecodeUTF8(Request.Form.Item(iCont)) Case "title" title = DecodeUTF8(Request.Form.Item(iCont)) Case "sort" sort = DecodeUTF8(Request.Form.Item(iCont)) Case "print_config" print_config = DecodeUTF8(Request.Form.Item(iCont)) Case "return_link_title" return_link_title = DecodeUTF8(Request.Form.Item(iCont)) Case "return_link_url" return_link_url = Request.Form.Item(iCont) Case "submit" 'Nada (Botão Submit) Case Else strCampos = strCampos & "
  " & Request.Form.Key(iCont) & ": " & Request.Form.Item(iCont) End Select Next '================================================================================== 'MONTA A MENSAGEM HTML 'Adiciona a informação de e-mail strCampos = strCampos & "

  E-mail do remetente: " & Request.Form("email") 'if len(trim(strredirect)) > 0 then ' Response.Redirect(trim(strredirect)) 'else Response.ContentType = "text/html" strHTML = "" strHTML = strHTML & "" if len(trim(title)) > 0 then strHTML = strHTML & "" & trim(title) & "" else strHTML = strHTML & "Thank You" end if strHTML = strHTML & "" strHTML = strHTML & " 0 then strHTML = strHTML & " bgcolor=" & trim(bgcolor) end if if len(trim(background)) > 0 then strHTML = strHTML & " background=" & trim(background) end if if len(trim(link_color)) > 0 then strHTML = strHTML & " link=" & trim(link_color) end if if len(trim(vlink_color)) > 0 then strHTML = strHTML & " vlink=" & trim(vlink_color) end if if len(trim(alink_color)) > 0 then strHTML = strHTML & " alink=" & trim(alink_color) end if if len(trim(text_color)) > 0 then strHTML = strHTML & " text=" & trim(text_color) end if strHTML = strHTML & ">" strHTML = strHTML & "
" if len(trim(title)) > 0 then strHTML = strHTML & "

" & trim(title) & "

" else strHTML = strHTML & "

Obrigado por entrar em contato

" end if strHTML = strHTML & "
" 'strHTML = strHTML & "

" 'strHTML = strHTML & "Below is what you submitted to " & recipient & ".
" strHTML = strHTML & strCampos strHTML = strHTML & "


" if len(trim(return_link_url)) > 0 then strHTML = strHTML & "" end if strHTML = strHTML & "" 'end if '================================================================================== strMsg = "" if trim(return_link_url) <> "" then strMsg = strMsg & "Abaixo estão os dados enviados a partir do formulário:" & strCampos & "" else strMsg = strMsg & "Dados enviados.
" & strCampos & "" end if 'ENVIA O E-MAIL if len(trim(email)) > 0 then email = trim(email) else email = "system.no.reply@yazigi.com" end if if len(trim(realname)) > 0 then realname = trim(realname) else realname = "System" end if if len(trim(subject)) > 0 then subject = trim(subject) else subject = "Subject: WWW Form Submission" end if 'gravalog vbCrlf & "|realname:" & realname & vbCrlf & "|email:" & email & vbCrlf & "|recipient:" & recipient & vbCrlf & "|subject:" & subject & vbCrlf & "|strMsg:" & strMsg & vbCrLf & vbCrLf enviaMails realname, email, recipient, recipientcc, recipientbcc, subject, strMsg, true, strredirect if trim(return_link_url) <> "" then Response.Redirect return_link_url & "?statusEnvio=OK" else Response.Write strHTML end if sub verificareferer(lista,referer) iCont = 0 blnOK = False arLista = split(lista,",") do while iCont<=ubound(arLista) if Instr(1,referer,arLista(iCont),1) > 0 then blnOK = True exit do end if iCont = iCont + 1 loop if blnOK = False then Response.Write "Invalid Referer!" Response.End end if end sub sub enviaMails(remetenteNome, remetenteMail, destinatariosMails, destinatariosMailsCC, destinatariosMailsBCC, assunto, mensagem, html, strredirect) on error resume next set oMail = Server.CreateObject("JMail.Message") oMail.Logging = True 'oMail.Silent = true if err.number <> 0 then Response.Write "Erro: " & err.Description gravalog vbCrLf & " - " & err.Description & vbCrLf Response.End end if oMail.Subject = assunto if html = false then oMail.Body = mensagem else oMail.HtmlBody = mensagem end if 'oMail.From = remetenteMail 'oMail.FromName = remetenteNome oMail.From = "system.no.reply@yazigi.com" oMail.FromName = remetenteNome oMail.MailServerUserName = "system.no.reply@yazigi.com"'Autenticação oMail.MailServerPassWord = "pksys2008"'Autenticação if len(trim(destinatariosMailsCC)) > 0 then arDestinatariosMailsCC = split(destinatariosMailsCC,",") iCont = 0 do while iCont<=ubound(arDestinatariosMailsCC) oMail.AddRecipientCC arDestinatariosMailsCC(iCont) iCont = iCont + 1 loop end if if len(trim(destinatariosMailsBCC)) > 0 then arDestinatariosMailsBCC = split(destinatariosMailsBCC,",") iCont = 0 do while iCont<=ubound(arDestinatariosMailsBCC) oMail.AddRecipientBCC arDestinatariosMailsBCC(iCont) iCont = iCont + 1 loop end if arDestinatariosMails = split(destinatariosMails,",") iCont = 0 do while iCont<=ubound(arDestinatariosMails) oMail.AddRecipient arDestinatariosMails(iCont) iCont = iCont + 1 loop oMail.Send("smtp.yazigi.com") if err.number <> 0 then Response.Write "Erro: " & err.Description gravalog vbCrLf & " - " & err.Description & " ( " & oMail.log & " ) " & vbCrLf Response.End end if if strredirect <> "" then response.redirect(strredirect) End if set oMail = Nothing end sub sub gravalog(strTexto) on error resume next dim oFso 'declaração de constantes dim ForAppending, ForWriting, ForReading 'definição das constantes ForAppending = 8 ForWriting = 2 ForReading = 1 set oFso = server.CreateObject("Scripting.FileSystemObject") set oFile = oFso.OpenTextFile(server.MapPath("log.txt"), ForAppending) oFile.Write(strTexto) oFile.Close set oFile = nothing set oFso = nothing end sub %>