Originariamente inviato da weppos
Esegui una query prima di inviare la mail ed inserisci l'ID nel corpo della mail.
Grazie, scusa questo è il code che utilizzo... dove metto la query:?
codice:
<% Option Explicit %>
<%
'leggi db
Set objConn=Server.CreateObject("ADODB.Connection")
strConn = Application("dbconn")
objConn.Open strConn
strsql = "SELECT email FROM tbl_login WHERE email='" &request("email")& "'"
Set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open strsql, strconn, 3, 3
if not objRs.bof and not objRs.eof then
Response.write "attenzione utente già registrato con questa e-mail "
else
'costruisci password
password = genera_pwd()
'vendemmia la form
nome = Request.Form("nome")
cognome = Request.Form("cognome")
email = Request.Form("email")
data_ricevuto = Date()
'metti dentro alla database
Set objConn = Server.CreateObject("ADODB.Connection")
strConn = Application("dbconn")
objConn.Open strConn
strsql = "INSERT INTO tbl_login (nome, cognome, login1, password1, data_ricevuto, email)"
strsql = strsql & " Values('"
strsql = strsql & nome & "','"
strsql = strsql & cognome & "','"
strsql = strsql & nome & "','"
strsql = strsql & password & "',#"
strsql = strsql & data_ricevuto & "#,'"
strsql = strsql & email & "')"
if err.number<>0 then response.write(err.description)
objconn.execute(strsql)
objConn.close
set objConn = Nothing
Response.write "molte grazie..."
call manda_posta(nome,password,email)
end if
Function genera_pwd()
...
end Function
Sub manda_posta(nome,password,email)
Dim objMail, messaggio
messaggio = messaggio & VBcrlf & "Nome = " & nome & "
"
messaggio = messaggio & VBcrlf & "Cognome = " & cognome & "
"
messaggio = messaggio & VBcrlf & "E-mail = " & email & "
"
Set objMail = Server.CreateObject("CDONTS.NewMail")
.............
Set objMail = Nothing
end sub
%>