Jump to content


Photo

Mensagem De Agradecimento


  • Faça o login para participar
3 replies to this topic

#1 zanelati2002

zanelati2002

    Normal

  • Usuários
  • 101 posts
  • Sexo:Não informado

Posted 28/12/2003, 10:03

este foi um codigo que fizeram para mim é para mandar a mensgem de agradecimento para o usuario que acabou de se registrar.
1. sera que eu coloquei o codigo no lugar certo
2. pois fiz um teste eu mesmo me cadastrando e até agora o email não chegou com meu login e senha . me ajude alguem crazy mais uma vez conto com você .
o erro que esta dando é que o arquivo não esta vindo para o email do usuario que se registrou segue o codigo inteiro do
<%
Option Explicit
Dim sql, rsUser, username, password, passwordconfirm, firstname, surname, email, dob, sex, notfilled(7), badflag, count, passwordLength, calltype, icon, starsign, dobmonth, dobday, sendemail

'Assign form values to variables
username = Request.Form("username")

'Make sure they've not put any quotation marks in their username
If InStr(username,chr(34)) <> 0 or InStr(username,chr(39)) <> 0 then
	errorfunction("invalidchars")
end if

firstname = Request.Form("firstname")
surname = Request.Form("surname")
email = Request.Form("email")
sex = Request.Form("sex")
password = Request.Form("password")
passwordconfirm = Request.Form("passwordconfirm")
dob = Request.Form("birth_day") & "/" & Request.Form("birth_month") & "/" & Request.Form("birth_year")
icon = Request.Form("icon")

'Only way to set a variable from a checkbox:
if Request.Form("sendemail") = "on" then sendemail = True else sendemail = False end if

'Check everything's been filled in, badflag determines whether error function is called
badflag = 0

'nofilled() is an array that will store the fields which are not filled in

if firstname = "" then
	notfilled(0) = "First Name"
	badflag = 1
end if
if surname = "" then
	notfilled(1) = "Surname"
	badflag = 1
end if
if email = "" then
	notfilled(2) = "Email"
	badflag = 1
end if
if username = "" then
	notfilled(3) = "Username"
	badflag = 1
end if
if password = "" then
	notfilled(4) = "Password"
	badflag = 1
end if
if sex = "" then
	notfilled(5) = "Sex"
	badflag = 1
end if
if IsDate(dob) = "False" then
	notfilled(6) = "Date of Birth"
	badflag = 1
end if
if icon = "" then
	notfilled(7) = "Your choice of icon"
	badflag = 1
end if

if badflag = 1 then
	signuperror()
end if

'Check password length is between 5 and 15 characters long
passwordLength = Len(password)
if passwordLength < 5 or passwordLength > 15 then
	errorfunction("length")
end if

'Check password and confirmed password are the same
if password <> passwordconfirm then
	errorfunction("confirm")
end if

'Open connection and insert user details into the database
%>
<!--#include file="conn.asp"-->
<%

'For a bit of profiling fun, get their star sign
getstarsign()

'Then add it to the database. It's in a seperate function because we need to error trap to see if there's been a duplicate entry. It's not good form to have On Error Resume Next throughout your whole page

UserUpdate()

Function UserUpdate()
On Error Resume Next

Set rsUser = Server.CreateObject("ADODB.Recordset")
rsUser.open "users", conn, 3, 3
rsUser.AddNew
rsUser("username") = username
rsUser("password") = password
rsUser("firstname") = firstname
rsUser("surname") = surname
rsUser("email") = email
rsUser("dob") = dob
rsUser("starsign") = starsign
rsUser("sex") = sex
rsUser("icon") = icon
rsUser("sendemail") = sendemail
rsUser.Update

if Err.Number = -2147217887 then
	Err.clear
	errorfunction("badusername")
else
	'Set username cookie to sign them in now
	Response.Cookies("username") = username
%>
<%

' Atribuindo os dados do formulário submetido as váriveis strNome e

strEmail

' strNome = Trim(Request.Form("username"))

strEmail = Trim(Request.Form("email"))

' Agora vamos criar uma conexão com o CDONTS para enviar os dados

' submetidos para o webmaster do site.

' O Email será enviado pelo usuário recém cadastrado

Set objMail = Server.CreateObject("CDONTS.NewMail")

objMail.To = "sitedozanelati@ig.com.br"

objMail.From = strEmail

objMail.Subject = "Cadastro no site!"

' Vamos criar agora uma mensagem padrão a ser enviado para o webmaster

' vbcrlf = quebra de linha

strMsgParaCadastro = "Nome: " & strusername & vbcrlf

strMsgParaCadastro = strMsgParaCadastro & "Email: " & stremail & vbcrlf


strMsgParaCadastro = strMsgParaCadastro & "-----------------------------"

objMail.Body = strMsgParaCadastro

objMail.Send

' Email para o webmaster enviado, portanto fechamos a conexão com o


CDONTS

Set objMail = nothing

' Agora imediatamente, criamos a mensagem padrão que será enviada
de agradecimento

' ao usuário recém cadastrado.

strMsgObrigado = "Olá " & strusername & vbcrlf

strMsgObrigado = strMsgObrigado & "Obrigado por se cadastrar em nosso site" & vbcrlf

strMsgObrigado = strMsgObrigado & "Breve você receberá mais informações." & vbcrlf & vbcrlf

strMsgObrigado = strMsgObrigado & "Abraços," & vbcrlf

strMsgObrigado = strMsgObrigado & "Webmaster"

' Criando novamente outra conexão com o CDONTS para enviar o email ao usuário.

Set objMail = Server.CreateObject("CDONTS.NewMail")

objMail.From = "sitedozanelati@ig.com.br"

objMail.To = strEmail ' observe

objMail.Subject = "Seu cadastro em nosso site!"

objMail.Body = strMsgObrigado

objMail.Send
%>
<html>
<head>
<title>Philweb - Free ASP Applications</title>
</head>
<body bgcolor="#FFFFFF" link="#DD0000" vlink="#DD0000" alink="#000000">
<font face="arial,helvetica" size=2>

  
<p><b>Obrigado por se cadastrar<%=firstname%>&nbsp;<%=surname%></b></p>

  
<p><b>Voc&ecirc; agora possui um nome de usu&aacute;rio <%=username%> e est&aacute; 
  logado!</b></p>

  
<p><a href="index.asp">Clique aqui para voltar &aacute; p&aacute;gina inicial</a>
<p>

  </font>
  </td>
</tr>
</table>

</body>
</html>

<%
rsUser.close
set rsUser = nothing
conn.close
set conn = nothing
%>
<%
end if
End Function%>


<%
Function getstarsign()
dobmonth = Request.Form("birth_month")
dobday = Request.Form("birth_day")
Select Case dobmonth
	Case 1
  if dobday < 21 then
 	 starsign = "Capricorn"
  else
 	 starsign = "Aquarius"
  end if
	Case 2
  if dobday < 20 then
 	 starsign = "Aquarius"
  else
 	 starsign = "Pisces"
  end if
	Case 3
  if dobday < 21 then
 	 starsign = "Pisces"
  else
 	 starsign = "Aries"
  end if
	Case 4
  if dobday < 21 then
 	 starsign = "Aries"
  else
 	 starsign = "Taurus"
  end if
	Case 5
  if dobday < 22 then
 	 starsign = "Taurus"
  else
 	 starsign = "Gemini"
  end if
	Case 6
  if dobday < 22 then
 	 starsign = "Gemini"
  else
 	 starsign = "Cancer"
  end if
	Case 7
  if dobday < 24 then
 	 starsign = "Cancer"
  else
 	 starsign = "Leo"
  end if
	Case 8
  if dobday < 24 then
 	 starsign = "Leo"
  else
 	 starsign = "Virgo"
  end if
	Case 9
  if dobday < 24 then
 	 starsign = "Virgo"
  else
 	 starsign = "Libra"
  end if
	Case 10
  if dobday < 24 then
 	 starsign = "Libra"
  else
 	 starsign = "Scorpio"
  end if
	Case 11
  if dobday < 23 then
 	 starsign = "Scorpio"
  else
 	 starsign = "Sagittarius"
  end if
	Case 12
  if dobday < 22 then
 	 starsign = "Sagittarius"
  else
 	 starsign = "Capricorn"
  end if
End Select
End Function
%>

<%Function signuperror()%>
<html>
<head>
<title>Philweb - Free ASP Applications</title>
</head>
<body bgcolor="#FFFFFF" link="#DD0000" vlink="#DD0000" alink="#000000">
<font face="arial,helvetica" size=2>

<p><b>You have not filled in the following fields correctly:</b></p>

<%for count = 0 to 7%>
	<%if notfilled(count) <> "" then%>
	<b><%=notfilled(count)%></b><br>
	<%end if%>
<%next%>

<p><a href="javascript:self.history.go(-1)">Please try again</a></p>

</font>
</table>

</body>
</html>
<%Response.end
End Function%>


<%Function errorfunction(calltype)%>
<html>
<head>
<title>Philweb - Free ASP Applications</title>
</head>
<body bgcolor="#FFFFFF" link="#DD0000" vlink="#DD0000" alink="#000000">
<font face="arial,helvetica" size=2>

<%if calltype = "confirm" then%>
<p><b>Your password and confirmed password were not the same</b></p>
<p><a href="javascript:self.history.go(-1)">Please try again</a></p>

</font>
</body>
</html>
<%Response.end%>
<%elseif calltype = "length" then%>
<p><b>Your password is not between 5 and 15 characters long</b></p>
<p><a href="javascript:self.history.go(-1)">Please try again</a></p>

</font>
</body>
</html>
<%Response.end%>
<%elseif calltype = "badusername" then%>
<p><b>Sorry, the username &quot;<%=username%>&quot; already exists.</b></p>
<p><a href="javascript:self.history.go(-1)">Please try again</a></p>

</font>
</body>
</html>
<%
rsUser.close
set rsUser = nothing
conn.close
set conn = nothing
Response.end
%>
<%elseif calltype = "invalidchars" then%>
<p><b>Sorry, your username cannot contain any quotation marks.</b></p>
<p><a href="javascript:self.history.go(-1)">Please try again</a></p>

</font>
</body>
</html>
<%Response.end%>
<%end if
End Function%>

Edição feita por: zanelati2002, 28/12/2003, 10:04.


#2 Matrix2003

Matrix2003

    24 Horas

  • Banidos
  • PipPipPipPipPip
  • 414 posts
  • Sexo:Não informado
  • Localidade:Bauru/SP
  • Interesses:ASP SOMENTE ASP

Posted 28/12/2003, 13:00

olá mais uma vez venho pedir que se interrese por este tropico pois é uma ieia a mais para aqueles que estejam começando em asp façam deem uma olhada por mim
Pessoal espero ajudar sempre que possivél todos vocês, não se esqueça do nosso site www.onemasters.com agora com muito mais atualidades todos os dias..
Projetos e muito mais....Valeu
Ricardo Zanelati

#3 cybermix

cybermix

    andrewsmedina.com.br

  • Ex-Admins
  • 3586 posts
  • Sexo:Não informado
  • Localidade:Não sou desse planeta não!!!!
  • Interesses:python, fireworks, linux, php, flash...

Posted 28/12/2003, 14:54

1º nao faca apela a ninguem em topicos como: por favor ze do armazem me ajude, conto com vc, vc é minha unica salvacao.

2º o codigo abaixo esta muito poluido, tem como fazer isso duma maneira + simples vo fazer qdo tiver + tempo e posto aqui fique tranquilo. nos do forum sempre ajudamos e respondemos quando sabemos
www.andrewsmedina.com.br

#4 cybermix

cybermix

    andrewsmedina.com.br

  • Ex-Admins
  • 3586 posts
  • Sexo:Não informado
  • Localidade:Não sou desse planeta não!!!!
  • Interesses:python, fireworks, linux, php, flash...

Posted 29/12/2003, 15:11

eu prometi ai esta meu exemplo
&acute;
<%
'conexao
Set conexao = Server.CreateObject("ADODB.Connection")
conexao.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db.mdb")

'verificando se o login existe
sql = "select * from users where login = '"&request.Form("login") & "'"
set rs = conexao.execute(sql)

if (rs.eof=false) then
	response.write "Esse login ja exite"
	rs = nothing
	conexao.close
	conexao = nothing
	response.End
else
	rs = nothing
	sql ="insert into users (login) values ('"&request.form("login")&"')"
	conexao.execute(sql)
	
	Set NovoEmail = Server.CreateObject("CDONTS.NewMail")
	NovoEmail.from = "voce@voce.com"
	NovoEmail.to = request.form("mail")
	NovoEmail.Subject = "Voce acaba de ser cadastrado"
	NovoEmail.Importance = 1
	NovoEmail.MailFormat = 0
	NovoEmail.BodyFormat = 0
	NovoEmail.Body = "parabens voce esta cadastrado"
	NovoEmail.send
	
	response.write "cadastro efetuado com sucesso"
	
	conexao.close
	set conexao = nothing
	set novoemail = nothing
end if
%>

www.andrewsmedina.com.br




0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq