%
'##### EMAIL
'Sub EmailASP()
If Request("acaba") = "sim" Then
Session("adm_descprod") = ""
Session("adm_email") = ""
End If
Select Case strAcao
Case "escrever"
varimg = " "
strTextoHtml = strTextoHtml & "
"
Case "grava"
email = Request("email")
para = Request("para")
assunto = Request("assunto")
Session("adm_email") = email
If email = "" Or assunto = "" Then
If email = "" Then
erro = "sim"
End If
If assunto = "" Then
erro2 = "sim"
End If
Response.Redirect "administrador.asp?link=news&acao=escrever&erro=" & erro & "&erro2=" & erro2 & "&msg=" & assunto
Else
strString = email
'strString = Codifica(strString) 'Usar somente qdo nao se usa a Ferramenta HTMLarea
email = ""
email = strString
strEmailHTML = ""
strEmailHTML = strEmailHTML & "" & nomeloja & " - " & urlloja & ""
strEmailHTML = strEmailHTML & ""
strEmailHTML = strEmailHTML & ""
strEmailHTML = strEmailHTML & ""
strEmailHTML = strEmailHTML & ""&email&""
strEmailHTML = strEmailHTML & ""
Select Case para
'Envia para email para todos
Case "todos"
Set rs = conexao.Execute("SELECT email FROM newsletter;")
While Not rs.EOF
EnviaEmail Application("HostLoja"), Application("ComponenteLoja"), emailloja, "", rs("email"), "Informativo " & nomeloja & " - " & assunto, strEmailHTML
rs.movenext
Wend
Set rs2 = conexao.Execute("SELECT nome, email FROM clientes")
While Not rs2.EOF
EnviaEmail Application("HostLoja"), Application("ComponenteLoja"), emailloja, "", Cripto(rs2("email"), False), "Informativo " & nomeloja & " - " & assunto, strEmailHTML
rs2.movenext
Wend
'Envia para email para todos os assinantes da newsletter da loja
Case "news"
Set rs = conexao.Execute("SELECT email FROM newsletter;")
While Not rs.EOF
EnviaEmail Application("HostLoja"), Application("ComponenteLoja"), emailloja, "", rs("email"), "Informativo " & nomeloja & " - " & assunto, strEmailHTML
rs.movenext
Wend
'Envia para email para todos os clientes da loja
Case "clientes"
Set rs = conexao.Execute("SELECT nome, email FROM clientes;")
While Not rs.EOF
EnviaEmail Application("HostLoja"), Application("ComponenteLoja"), emailloja, "", Cripto(rs("email"), False), "Informativo " & nomeloja & " - " & assunto, strEmailHTML
rs.movenext
Wend
'Envia para email somente para o email selecionado (nao importa se é cliente ou assinante da newsletter
Case Else
if instr(para, "@") <> 0 then
EnviaEmail Application("HostLoja"), Application("ComponenteLoja"), emailloja, "", para, "Informativo " & nomeloja & " - " & assunto, strEmailHTML
end if
End Select
Response.Redirect "administrador.asp?link=news&acao=escrever&sucesso=sim&acaba=sim"
End If
Case "excluir"
strTextoHtml = strTextoHtml & " Excluir emails cadastrados na newsletter da loja"
finalera = Request.QueryString("final")
pag = Request.QueryString("itens")
pesss = Trim(Request.QueryString("pesq"))
pagdxx = Request.QueryString("pagina")
pesqsa = Request.QueryString("pesqsa")
catege = Request("cat")
If pesss = "" Then
pesss = "-"
palavra = Split(Trim("asdfghjklçqwertyuiopzxcvbnm"), " ")
Else
pesss = pesss
palavra = Split(Trim(Request.QueryString("pesq")), " ")
End If
If pag = "" Then
inicial = 0
final = 10
Else
inicial = pag
final = 10
End If
If pesqsa = "" Then
restinho = ""
catege = "todos"
Else
If catege = "todos" Or catege = "xxx" Or catege = "" Then
resto = ""
Else
resto = "idsessao = '" & catege & "' and"
End If
palavraz = Split(Trim(pesqsa), " ")
restinho = "WHERE email LIKE '%" & palavraz(0) & "%'"
End If
Set rs = conexao.Execute("SELECT email,datacad FROM newsletter " & restinho)
If rs.EOF Or rs.bof Then
strTextoHtml = strTextoHtml & "
"
rs.Close
Set rs = Nothing
End If
Case "exclui"
notz = Request.QueryString("cli")
Set dados = conexao.Execute("delete from newsletter where email = '" & notz & "';")
Response.Redirect "?link=news&acao=excluir&status=sucesso"
End Select
'End Sub
%>