Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Boa Tarde,
Estou tentatndo adaptar um codigo que peguei aqui no forum para enviar e-mail, tenho uma base de dados com 3.500 e-mails cadastrados, e esse codigo manda de 100 em 100 emails.
Bom, ele conciste de 3 paginas, Index.asp: pagina com 2 iframes, form.asp: pagina com os txts para envio, envia.asp: codigo para envio
Quando vo teste a pagina acontece o seguinte erro:
>
Microsoft VBScript compilation error '800a0408'
Invalid character
/loja/mail/teste2.asp, line 5
vc_assunto = trim(Request("vc_assunto"))
----------^
Vou postar aqui tambem os codigos das paginas:
Index.asp
<iframe width="600" height="300" src="form.asp">
</iframe>
<br><br><br><br><br><br>
<iframe width="600" height="300" src="envia.asp">
</iframe>
form.asp
<form name="formulario" method="get" action="envia.asp">
<label>
<input type="text" name="vc_assunto" id="vc_assunto">
</label>
<label>
<input type="text" name="tx_editor" id="tx_editor">
<input type="hidden" name="pagina" value="1">
<input type="hidden" name="contador" value="1">
</label>
<label>
<input type="submit" name="Enviar" id="Enviar" value="Enviar">
</label>
</form>
envia.asp
<%
Response.Buffer = FALSE
Server.ScriptTimeout = 99999
vc_assunto = (trim(Request("vc_assunto")))
tx_editor = (trim(Request("tx_editor")))
pagina = int(Request("pagina"))
contador = int(Request("contador"))
if pagina = 1 then
contador = 0
%>
<script>
parent.formulario.document.getElementById("td_status").innerHTML = '<input type="text" name="it_enviados" value="0" size="5"> emails enviados de <input type="text" name="it_total" value="0" size="5">'
</script>end if
conn = "UID=xxx; PWD=xxx; driver={SQL Server}; SERVER=200.000.000.00; DATABASE=Co"
SET RS = server.CreateObject("ADODB.Recordset")
RS.Open sql, conn, 3
sql = "SELECT em_pessoa FROM cob_tb_ContatoEmail"
set rs = conexao.execute(sql)
varEmail = rs("em_pessoa")
it_total = RS.RecordCount
RS.PageSize = 100 //Aki é definido o tamanho do pacote que será enviado
RS.absolutepage = pagina
if pagina = 1 then
%>
<script>
parent.formulario.document.getElementById("it_total").value = <%=it_total%>;
</script>i = 0
do while NOT RS.EOF AND i < RS.PageSize
set objCDOSYSMail = Server.CreateObject ("CDO.Message")
set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
Set objCDOSYSMail.Configuration = objCDOSYSCon
With objCDOSYSCon
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.empesa.com.br"
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 50000
.Fields.update
End With
With objCDOSYSMail
.From = "informativo@empresa.com.br"
.To = rs("em_pessoa")
.Subject = vc_assunto
.HtmlBody = tx_editor
.CC = "informativo@empresa.com.br"
.Send
End With
set objCDOSYSMail = nothing
set objCDOSYSCon = nothing
%>
<script>
parent.formulario.document.getElementById("it_enviados").value = '<%=i + contador%>';
</script>
<%
i = i + 1
RS.MoveNext
loop
%>
<script>
parent.formulario.document.getElementById("pagina").value = Number(parent.formulario.document.getElementById("pagina").value) + Number(1);
parent.formulario.document.getElementById("contador").value = Number(parent.formulario.document.getElementById("contador").value) + Number(<%=i%>);
</script><%
if RS.PageCount >= pagina then%>
<script>
setTimeout('parent.formulario.document.frm.submit()',5000); // De 5 em 5 segundos ele vai mandar o formulario
</script><%
else%>
<script>
alert('Mailing enviado com sucesso!');
</script><%
end if
%>
a linha do erro é esta:
vc_assunto = (trim(Request("vc_assunto")))
tx_editor = (trim(Request("tx_editor")))
não sei oque estou fazendo de errado, tentei seguir o exemplo do tutorial original, mas la só tinha o envia.asp, o formulario e a pagina com os includes tive fazer eu mesmo, acho que é ae que eu estou errando, se alguem puder me ajudar!!!att
Carregando comentários...