Ir para conteúdo
Fórum Script Brasil
  • 0

Sistema De Envio De Informações Por Email


bolomaster

Pergunta

Olá pessoal, é o seguinte eu tenho um sistema que envia informações por email e estas informações são retiradas de um banco de dados da seguinte forma

SELECT * FROM TABELA WHERE CAMPODEDATAEHORA BETWEEN #DIAANTERIORATE1900H# AND #DIATUALATE18:59#

E QUANDO VIRA O MÊS ELE SELECIONA TUDO. PARECE LOUCURA.. RS MAS É VERDADE, E QUANDO POR EXEMPLO você TEM INFORMAÇÕES DO DIA 15 DE JUNHO E 15 DE JULHO ELE está ENVIANDO AS DUAS INFORMAÇÕES SO QUE não CONSIGO ENTENDER O porque DESTE ERRO. VOU POSTAR O CODIGO, SERÁ QUE alguém PODE ME AJUDAR NO mês PASSADO UM AMIGO já AJUDOU FUNCIONOU beleza, MAS AGORA QUE VIROU O mês DEU DE NOVO

<%

dim caminho, hora, data, titulo, texto, enviadopor, htmlemail, mail, db, rs, sql, dataini, datafim, id

dim mês, dia, ano

dia = day(date)

mês = month(date)

ano = year(date)

dataini = mês&"/"&dia-1&"/"&ano&" 19:00:00"

datafim = mês&"/"&dia&"/"&ano&" 18:59:59"

set db = server.CreateObject("ADODB.connection")

set rs = Server.CreateObject("ADODB.RecordSet")

caminho = server.MapPath("dados/informativo2.mdb")

db.open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & caminho

sql = "Select * from informativos where hora between #"&dataini&"# and #"&datafim&"#"

rs.open sql,db,3,3

if rs.bof then

Response.write "De "&dataini&" até "&datafim&" não foram postadas informações."

set mail = createObject("CDONTS.newMail")

mail.from = "NOME@DOMINIO.COM"

mail.to = "NOME@DOMINIO.COM"

mail.subject = "Informativo Atenas"

htmlemail = htmlemail &"De "&dataini&" até "&datafim&" Não foram postadas informações"

mail.body = htmlemail

mail.MailFormat = 0

mail.Bodyformat = 0

mail.send

set mail = nothing

Else

set mail = createObject("CDONTS.newMail")

mail.from = "NOME@DOMINIO.COM"

mail.to = "NOME@DOMINIO.COM"

mail.subject = "Informativo Atenas de "&dataini& " até "&datafim&"."

htmlemail = htmlemail &"<style type='text/css'>"

htmlemail = htmlemail & "a:link{text-decoration:none;} "

htmlemail = htmlemail & ".fonte { color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: xx-small;}"

htmlemail = htmlemail & ".fonte2 { color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: x-small;}"

htmlemail = htmlemail & ".link2 { color: #F75E6C; font-family: Arial, Helvetica, sans-serif; font-size: xx-small;}"

htmlemail = htmlemail & ".link2:hover{ color:#FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: xx-small;}"

htmlemail = htmlemail & ".link { color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: x-small;}"

htmlemail = htmlemail & ".link:hover{ color:#F75E6C; font-family: Arial, Helvetica, sans-serif; font-size: x-small;}"

htmlemail = htmlemail & "</style>"

htmlemail = htmlemail & "<body background='http://www.atenas.edu.br/informativo/imagens/fundo_barra.gif' leftmargin='0' rightmargin='0' bottommargin='0' topmargin='0'>"

htmlemail = htmlemail & "<font color='#FFFFFF'>"

htmlemail = htmlemail & "<table width='100%' border='0' cellpadding='0' cellspacing='0' background='http://www.atenas.edu.br/informativo/imagens/fundo_barra.gif' class='fonte'>"

htmlemail = htmlemail & "<tr>"

htmlemail = htmlemail & "<td colspan='3'><div align='center'>"

htmlemail = htmlemail & "<img src='http://www.atenas.edu.br/informativo/imagens/topoinformativo.jpg'"

htmlemail = htmlemail &" </div></td>"

htmlemail = htmlemail & "</tr>"

htmlemail = htmlemail & "<tr>"

htmlemail = htmlemail & "<td colspan='3' bgcolor='#FFFFFF'></td>"

htmlemail = htmlemail & "</tr>"

htmlemail = htmlemail &"<tr>"

htmlemail = htmlemail & "<td colspan='2'>" &"&nbsp;"& "</td>"

htmlemail = htmlemail &" <td width='47%'>O melhor meio de comunica&ccedil;&atilde;o da Faculdade e Col&eacute;gio Atenas de Paracatu</td>"

htmlemail = htmlemail & "</tr>"

htmlemail = htmlemail & "<tr>"

htmlemail = htmlemail &" <td colspan='3' bgcolor='#FFFFFF'></td>"

htmlemail = htmlemail &"</tr>"

htmlemail = htmlemail &"<tr>"

htmlemail = htmlemail &"<td width='17%'>&nbsp;</td>"

htmlemail = htmlemail &"<td width='36%'>&nbsp;</td>"

htmlemail = htmlemail &"<td>&nbsp;</td>"

htmlemail = htmlemail &"</tr>"

htmlemail = htmlemail &"<tr>"

htmlemail = htmlemail &"<td>&nbsp;</td>"&"<td>&nbsp;</td>"&"<td>&nbsp;</td>"&"</tr>"&"<tr>"

htmlemail = htmlemail &" <td colspan='3'><div align='center' class='fonte2'><strong>AS INFOMAÇÕES POSTADAS FORAM:</strong></div></td>"

htmlemail = htmlemail &"</tr>"&"<tr>"&"<td>&nbsp;</td>"&"<td>&nbsp;</td>"&"<td>&nbsp;</td>"&"</tr>"&"<tr>"&"<td colspan='3'> </font>"

do while not rs.eof

hora = rs.fields("hora")

data = rs.fields("data")

texto = rs.fields("texto")

id = rs.fields("id")

titulo = rs.fields("titulo")

enviadopor = rs.fields("enviadopor")

htmlemail = htmlemail &"<table width='85%' border='0' align='center' cellpadding='0' cellspacing='0' class='fonte2'>"

htmlemail = htmlemail &"<tr>"

htmlemail = htmlemail &" <td width='18%' rowspan='2'><div align='center'><img src='http://www.atenas.edu.br/informativo/imagens/ico02.gif' width='56' height='49'></div></td>"

htmlemail = htmlemail & " <td width='82%'>" &"<strong>"&" T&iacute;tulo:<a href='http://www.atenas.edu.br/informativo/vercomunicado.asp?id="&id&"' class='link'>"& titulo &" </strong></a> </td>"

htmlemail = htmlemail & "</tr>"

htmlemail = htmlemail & " <tr>"

htmlemail = htmlemail &" <td><strong>Postado Por: " &enviadopor&" em: "&hora& "</strong></td>"

htmlemail = htmlemail &"</tr>"&"<tr>"&"<td colspan='2' bgcolor='#FFFFFF'></td>"&"</tr>"&"<tr>"&"<td colspan='2'>&nbsp;</td>"&"</tr>"&"</table>"

rs.movenext

loop

rs.close

db.close

set rs = nothing

set db = nothing

htmlemail = htmlemail &"</td>"&"</tr>"&"<tr>"&"<td colspan='3'>Se não conseguir visualizar este email <a href='http://WWW.SITE.COM.BR/informativo/' target='_blank' class='link2'>Clique aqui</a></td>"&"</tr>"&"</table>"

mail.body = htmlemail

mail.MailFormat = 0

mail.Bodyformat = 0

mail.send

set mail = nothing

Response.write htmlemail

end if

%>

OBRIGADO E SE alguém SOUBER DE ALGO.. AGRADEÇO

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      651,9k
×
×
  • Criar Novo...