Visualizzazione dei risultati da 1 a 8 su 8
  1. #1

    modifico db e se "ok" invio la mail

    salve attutti

    premessa sto imparando (quindi non ridete se dico o chiedo assurdità )

    1.ho una pagina ASP che elabora le variabile inviatele da un file swf che vengono scritte nel db...e fin qui tutto ok.
    <%@LANGUAGE="VBSCRIPT"%>


    <%
    Dim nome, mail
    nome= Request.Form("nome")
    mail= Request.Form("mail")

    set Command1 = Server.CreateObject("ADODB.Command")
    Command1.ActiveConnection = MM_conn_STRING
    Command1.CommandText = "INSERT INTO tabella (nome, mail) VALUES ('" & nome & "','" & mail & "')"

    Command1.CommandType = 1
    Command1.CommandTimeout = 0
    Command1.Prepared = true
    Command1.Execute()

    Set Command1 = Nothing

    %>


    2.ho un altro file ASp che elabora le variabile inviatele da un file swf e invio con persits.mailsender e fin qui tutto ok

    <%option explicit%>
    <%
    Dim objMail , strBody


    Set objMail = Server.CreateObject("Persits.MailSender")
    StrBody = "<HTML><HEAD><TITLE>EMAIL</TITLE></HEAD><BODY bgcolor=#ffffff>"
    StrBody = StrBody + "<img src=logo.gif'>" & "

    "
    StrBody = StrBody + "<font face=Verdana size= 1 color= black>Il tuoi dati sono stati aggiunti alla nostra mailing list! :</FONT>
    "
    StrBody = StrBody + "<font face=Verdana size= 2 color= black>nome: <font face=Verdana size= 2 color= green>" & Request.Form("nome") &"</FONT>
    "

    StrBody = StrBody + "<font face=Verdana size= 2 color= black>mail: <font face=Verdana size= 2 color= red>" & Request.Form("mail") & "</FONT>
    "


    StrBody = StrBody + "</BODY></HTML>"


    objMail.Host = "smtp.server.it"

    objMail.From = "inini@hihih.it"


    objMail.FromName = ""

    objMail.AddAddress "" & Request.Form("mail") & ""
    objMail.AddCC "inini@hihih.it"

    objMail.Subject = "conferma"

    objMail.Body = strBody
    objMail.IsHTML = True

    objMail.Send

    Set objMail = Nothing
    %>

    il mio problema è che singolarmente le pagine fungono, ma vorrei concatenare i due eventi in un unica pagina ASP: prima scrivo nel db (code1) e se OK allora elaboro oggetto mail (code2) che invierà all'utente conferma.

    ho provato con end if con senza <% e %>...nada

    qualcuno mi dice dove sbaglio?

    grazie

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
    <% 
    Dim objMail , strBody 
    
    Set objMail = Server.CreateObject("Persits.MailSender") 
    StrBody = "<HTML><HEAD><TITLE>EMAIL</TITLE></HEAD><BODY bgcolor=#ffffff>" 
    StrBody = StrBody + "<img src=logo.gif'>" & "
    
    " 
    StrBody = StrBody + "<font face=Verdana size= 1 color= black>Il tuoi dati sono stati aggiunti alla nostra mailing list! :</FONT>
     " 
    StrBody = StrBody + "<font face=Verdana size= 2 color= black>nome: <font face=Verdana size= 2 color= green>" & nome &"</FONT>
    " 
    
    StrBody = StrBody + "<font face=Verdana size= 2 color= black>mail: <font face=Verdana size= 2 color= red>" & mail & "</FONT>
    " 
    
    
    StrBody = StrBody + "</BODY></HTML>" 
    
    
    objMail.Host = "smtp.server.it" 
    
    objMail.From = "inini@hihih.it" 
    
    
    objMail.FromName = "" 
    
    objMail.AddAddress "" & mail & "" 
    objMail.AddCC "inini@hihih.it" 
    
    objMail.Subject = "conferma" 
    
    objMail.Body = strBody 
    objMail.IsHTML = True 
    
    objMail.Send 
    
    Set objMail = Nothing 
    %>
    Metti questo pezzo in coda al primo file.

    Roby

  3. #3
    ti ringrazio....provo

  4. #4
    niente!...ho provato

    scrive nel db ma poi non invia la mail

  5. #5
    Così non funziona ? sicuro che passi tutti i parametri?

    codice:
    <%@LANGUAGE="VBSCRIPT"%> 
    
     
    <% 
    Dim nome, mail 
    nome= Request.Form("nome") 
    mail= Request.Form("mail") 
    
    set Command1 = Server.CreateObject("ADODB.Command") 
    Command1.ActiveConnection = MM_conn_STRING 
    Command1.CommandText = "INSERT INTO tabella (nome, mail) VALUES ('" & nome & "','" & mail & "')" 
    
    Command1.CommandType = 1 
    Command1.CommandTimeout = 0 
    Command1.Prepared = true 
    Command1.Execute() 
    
    Set Command1 = Nothing 
    
    Dim objMail , strBody 
    
    
    Set objMail = Server.CreateObject("Persits.MailSender") 
    StrBody = "<HTML><HEAD><TITLE>EMAIL</TITLE></HEAD><BODY bgcolor=#ffffff>" 
    StrBody = StrBody + "<img src=logo.gif'>" & "
    
    " 
    StrBody = StrBody + "<font face=Verdana size= 1 color= black>Il tuoi dati sono stati aggiunti alla nostra mailing list! :</FONT>
     " 
    StrBody = StrBody + "<font face=Verdana size= 2 color= black>nome: <font face=Verdana size= 2 color= green>" & Request.Form("nome") &"</FONT>
    " 
    
    StrBody = StrBody + "<font face=Verdana size= 2 color= black>mail: <font face=Verdana size= 2 color= red>" & Request.Form("mail") & "</FONT>
    " 
    
    
    StrBody = StrBody + "</BODY></HTML>" 
    
    
    objMail.Host = "smtp.server.it" 
    
    objMail.From = "inini@hihih.it" 
    
    
    objMail.FromName = "" 
    
    objMail.AddAddress "" & Request.Form("mail") & "" 
    objMail.AddCC "inini@hihih.it" 
    
    objMail.Subject = "conferma" 
    
    objMail.Body = strBody 
    objMail.IsHTML = True 
    
    objMail.Send 
    
    Set objMail = Nothing 
    
    
    %>

  6. #6
    niente!...ho provato

    scrive nel db ma poi non invia la mail

  7. #7
    il problema è che da soli funzionano se li unisco viene risolto il primo ma non il secondo

  8. #8
    ops... non mi ero accorto che le variabili indicate nell'objmail erano diverse da quelle del commenad...pardon infatti ho corretto la svista è funziona alla grande!!

    grazie a tutti

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.