Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Ricardo Gaspar

Aniversariantes do Mes

Recommended Posts

Depois de bater com a cabeça lá consegui filtrar os aniversariantes por mes e enviar por email. Agora necessito de uma store procedure que me permita enviar este email com os aniversariantes todos os meses no dia 01.

 

Alguem poderá dar-me ideias de como fazer isso?

 

sera do tipo now send 01 janeiro, 01 fevereiro. Claro que a informação que será enviada para mim terá os aniversarios desse mesmo mês.

 

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><!-- #include file=Conn/config.inc --><%session.LCID = 2070		dim dd, mm, aa			function FormataData(data)				dd = day(data)				mm = month(data)				aa = year(data)					if len(dd) = 1 then dd = "0" & dd					if len(mm) = 1 then mm = "0" & mm						FormataData = cstr(dd & "-" & mm & "-" & aa)			end function		dim data_atual			data_atual = FormataData(Date)		dim niver_dia, niver_mes, niver_ano			niver_dia = Day(data_atual)			niver_mes = Month(data_atual)			niver_ano = Year(data_atual)				if Len(niver_dia) < 2 then					niver_dia = "0"&Day(data_atual)				end if								if Len(niver_mes) < 2 then					niver_mes = "0"&Month(data_atual)				end if		dim sql			'### Mostra todos os aniversariantes do mês actual ordenados por registo de id			sql = "select id, primaryname, lastname, aniversario from users where month(aniversario) = "&niver_mes&" order by id desc"						RsConn.open sql, Conn				if rsconn.eof then												response.Write("não existe aniversariantes")					response.End										else				Call EnviaEmail			end if'####################################################################################################################Sub EnviaEmail()dim enviaremail, HTML'##################### CORPO DO EMAIL MOSTRANDO OS DADOS FILTRADOS PELA STRING SQL ##################################HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"HTML = HTML & "<html>"HTML = HTML & "<head>"HTML = HTML & "<meta http-equiv=""Content-Type"""HTML = HTML & "content=""text/html; charset=iso-8859-1"">"HTML = HTML & "<meta name=""GENERATOR"""HTML = HTML & " content=""Microsoft Visual Studio 6.0"">"HTML = HTML & "<title>Enviando CDONTS Email Using HTML</title>"HTML = HTML & "</head>"HTML = HTML & "<body bgcolor=""FFFFFF"">"HTML = HTML & "<table width=""100%"" border=""1"">"HTML = HTML & "<TR Align=""top"">"HTML = HTML & "<TD width=""15%"">Nome</td><td width=""15%"">Ultimo</td><td width=""15%"">Aniversario</td>"HTML = HTML & "</TR>"do while not rsconn.eofHTML = HTML & "<TR align=""top"">"HTML = HTML & "<td width=""15%""><Font color=""000000"" size=""1"">"HTML = HTML & Rsconn("primaryname")HTML = HTML & "</td>"HTML = HTML & "<td width=""15%""><Font color=""000000"" size=""1"">"HTML = HTML & Rsconn("lastname")HTML = HTML & "</td>"HTML = HTML & "<td width=""15%""><Font color=""000000"" size=""1"">"HTML = HTML & Rsconn("aniversario")HTML = HTML & "</td>"rsconn.movenextloopHTML = HTML & "</tr>"HTML = HTML & "</table>"HTML = HTML & "</body>"HTML = HTML & "</html>"'##################### FIM DO CORPO DO EMAIL ##########################################################################Set enviarmail = server.createobject("CDONTS.NewMail")'enviarmail.From = "ptrgasparxp0" '# TEM QUE ESTAR IGUAL Fully-Qualifield Domain Name no IISenviarmail.to = "meumail@pt"'enviarmail.cc = "enviar cc"'enviarmail.bcc = "enviar bcc"enviarmail.subject = "Aniversarios"enviarmail.bodyformat = 0 '#Set the e-mail body format (0=HTML 1=Text)enviarmail.mailformat = 0 '#Set the mail format (0=MIME 1=Text)enviarmail.importance = 1 '#Importance of the e-mail (0=Low, 1=Normal, 2=High)enviarmail.body = HTML '# Variavel do CORPO DO EMAILOn Error Resume Next '#Trata dos errosenviarmail.send		If Err <> 0 Then 				Response.Write "Ocorreu o erro: " & Err.Description 		Else				Response.Write("Enviado com Sucesso!")		set RsConn = nothing		Set Conn = nothing		RsConn.Close		Conn.Close		End Ifset enviarmail = nothingEnd Sub'#######################################################################################################################%>

 

Muito obrigado pela colaboração.

Compartilhar este post


Link para o post
Compartilhar em outros sites

alguma ajuda na duvida que requisitei? Obrigado

Depois de bater com a cabeça lá consegui filtrar os aniversariantes por mes e enviar por email. Agora necessito de uma store procedure que me permita enviar este email com os aniversariantes todos os meses no dia 01.Alguem poderá dar-me ideias de como fazer isso?sera do tipo now send 01 janeiro, 01 fevereiro. Claro que a informação que será enviada para mim terá os aniversarios desse mesmo mês.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><!-- #include file=Conn/config.inc --><%session.LCID = 2070		dim dd, mm, aa			function FormataData(data)				dd = day(data)				mm = month(data)				aa = year(data)					if len(dd) = 1 then dd = "0" & dd					if len(mm) = 1 then mm = "0" & mm						FormataData = cstr(dd & "-" & mm & "-" & aa)			end function		dim data_atual			data_atual = FormataData(Date)		dim niver_dia, niver_mes, niver_ano			niver_dia = Day(data_atual)			niver_mes = Month(data_atual)			niver_ano = Year(data_atual)				if Len(niver_dia) < 2 then					niver_dia = "0"&Day(data_atual)				end if								if Len(niver_mes) < 2 then					niver_mes = "0"&Month(data_atual)				end if		dim sql			'### Mostra todos os aniversariantes do mês actual ordenados por registo de id			sql = "select id, primaryname, lastname, aniversario from users where month(aniversario) = "&niver_mes&" order by id desc"						RsConn.open sql, Conn				if rsconn.eof then												response.Write("não existe aniversariantes")					response.End										else				Call EnviaEmail			end if'####################################################################################################################Sub EnviaEmail()dim enviaremail, HTML'##################### CORPO DO EMAIL MOSTRANDO OS DADOS FILTRADOS PELA STRING SQL ##################################HTML = "<!DOCTYPE HTML PUBLIC""-//IETF//DTD HTML//EN"">"HTML = HTML & "<html>"HTML = HTML & "<head>"HTML = HTML & "<meta http-equiv=""Content-Type"""HTML = HTML & "content=""text/html; charset=iso-8859-1"">"HTML = HTML & "<meta name=""GENERATOR"""HTML = HTML & " content=""Microsoft Visual Studio 6.0"">"HTML = HTML & "<title>Enviando CDONTS Email Using HTML</title>"HTML = HTML & "</head>"HTML = HTML & "<body bgcolor=""FFFFFF"">"HTML = HTML & "<table width=""100%"" border=""1"">"HTML = HTML & "<TR Align=""top"">"HTML = HTML & "<TD width=""15%"">Nome</td><td width=""15%"">Ultimo</td><td width=""15%"">Aniversario</td>"HTML = HTML & "</TR>"do while not rsconn.eofHTML = HTML & "<TR align=""top"">"HTML = HTML & "<td width=""15%""><Font color=""000000"" size=""1"">"HTML = HTML & Rsconn("primaryname")HTML = HTML & "</td>"HTML = HTML & "<td width=""15%""><Font color=""000000"" size=""1"">"HTML = HTML & Rsconn("lastname")HTML = HTML & "</td>"HTML = HTML & "<td width=""15%""><Font color=""000000"" size=""1"">"HTML = HTML & Rsconn("aniversario")HTML = HTML & "</td>"rsconn.movenextloopHTML = HTML & "</tr>"HTML = HTML & "</table>"HTML = HTML & "</body>"HTML = HTML & "</html>"'##################### FIM DO CORPO DO EMAIL ##########################################################################Set enviarmail = server.createobject("CDONTS.NewMail")'enviarmail.From = "ptrgasparxp0" '# TEM QUE ESTAR IGUAL Fully-Qualifield Domain Name no IISenviarmail.to = "meumail@pt"'enviarmail.cc = "enviar cc"'enviarmail.bcc = "enviar bcc"enviarmail.subject = "Aniversarios"enviarmail.bodyformat = 0 '#Set the e-mail body format (0=HTML 1=Text)enviarmail.mailformat = 0 '#Set the mail format (0=MIME 1=Text)enviarmail.importance = 1 '#Importance of the e-mail (0=Low, 1=Normal, 2=High)enviarmail.body = HTML '# Variavel do CORPO DO EMAILOn Error Resume Next '#Trata dos errosenviarmail.send		If Err <> 0 Then 				Response.Write "Ocorreu o erro: " & Err.Description 		Else				Response.Write("Enviado com Sucesso!")		set RsConn = nothing		Set Conn = nothing		RsConn.Close		Conn.Close		End Ifset enviarmail = nothingEnd Sub'#######################################################################################################################%>
Muito obrigado pela colaboração.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.