Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 17

Discussione: newsletter

  1. #1

    newsletter

    Ciao a tutti.

    Vi riporto questo problema:

    - LoginAdmin.asp ---- che loga l'amministratore (funziona)
    - LoginVerificaAdmin.asp ---- che verifica l'amministratore (funziona)
    - WelcomeUserAdmin.asp ---- che da il benvenuto all'amministratore e lo manda alla compilazione dell'oggetto e del contenuto della newsletter (funziona)
    - Gestione_newsletter.asp ---- Chiede l'oggetto e il contenuto della newsletter e lo invia con CDO (lo chiede il server dove ho pubblicato il sito) (da errore)

    Vi posto il file gestione_newsletter.asp e vi ringrazio per l'aiuto che vorrete darmi.

    Antonella

    <html>

    <head>
    <title>GESTIONE NEWSLETTER</title>
    </head>

    <body>

    <font size="4" face="Verdana">&gt; Invia newsletter!</font></p>


    <%
    ' LEGGE QUELLO CHE DEVE FARE
    operazione = Request.QueryString("tipo")

    ' PERCORSO DEL DATABASE
    Set Conn = Server.CreateObject("ADODB.Commection")
    Conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" + Server.MapPath("Database\Prenotazioni.Mdb")

    ' OPERAZIONE = INVIA IL MESSAGGIO DI NEWSLETTER
    IF operazione = "invia" then

    ' VERIFICA CHE I CAMPI SIANO STATI COMPILATI
    IF Request("oggetto") <> "" and Request("testo") <> "" then

    ' APRE LA CONNESSIONE AL DATABASE E PRELEVA LE EMAIL DELLA NEWSLETTER

    Set RecSet = Server.CreateObject("ADODB.recordset")
    SQL = "SELECT EMail FROM Anagrafica"
    RecSet.Open SQL, Conn, adopenstatic, adlockOptimistic


    IF not RecSet.Eof then

    ' INDIRIZZO EMAIL NOSTRO
    mittente = "yyyyyy@yyyyyy.it"

    Do until Recset.eof

    ' PRELEVA L'EMAIL DELL'UTENTE DAL NOSTRO DATABASE
    destinatario = RecSet("email")

    ' PRELEVA IL TESTO DEL MESSAGGIO DA INVIARE
    testo = Request.Form("testo")

    ' PRELEVA L'OGGETTO DEL MESSAGGIO DA INVIARE
    oggetto = Request.Form("oggetto")

    Dim objCDOMail 'Holds the mail server object
    Dim objCDOConf 'Holds the mail server object
    Dim Flds 'Holds the mail server parameters for configuration
    'Create the e-mail server object
    Set objCDOMail = CreateObject("CDO.Message")
    Set objCDOConf = CreateObject("CDO.Configuration")
    Set Flds = objCDOConf.Fields
    with objCDOMail
    Set .Configuration = objCDOConf
    .To = destinatario
    .From = mittente
    .Subject = oggetto
    ' FORMATO EMAIL
    .BodyFormat = Request.Form("formato")
    .MailFormat = Request.Form("formato")

    .HTMLBody = Messaggio

    ' INVIA L'EMAIL E..
    .Send
    End with
    'Close the server object
    Set objCDOMail = Nothing
    Set objCDOConf = Nothing
    Set Flds = Nothing

    ' PASSA AVANTI...
    RecSet.Movenext
    loop

    End If

    RecSet.Close
    Conn.close
    Set RecSet = Nothing
    Set Conn = Nothing

    ' VISUALIZZA UN MESSAGGIO DI CONFERMA:
    %>
    <hr>
    <p align="center"><font face="Verdana" size="4">Messaggio inviati
    correttamente!
    </font></p>
    <hr>
    <%
    Else
    %>
    <hr>
    <p align="center"><font face="Verdana" size="4">Compila tutti i campi!</font></p>
    <hr>
    <%
    End IF
    Else
    %>
    <form method="POST" action="Gestione_Newsletter.asp?tipo=invia">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
    <td width="26%"><font face="Verdana" size="2">Oggetto messaggio:</font></td>
    <td width="74%"><font face="Verdana" size="2"><input type="text" name="oggetto" size="20"></font></td>
    </tr>
    <tr>
    <td width="26%"><font face="Verdana" size="2">Testo messaggio:</font></td>
    <td width="74%"><font face="Verdana" size="2"><textarea rows="6" name="testo" cols="67"></textarea></font></td>
    </tr>
    <tr>
    <td width="26%"><font face="Verdana" size="2">Formato e-mail:</font></td>
    <td width="74%"><select size="1" name="formato">
    <option selected value="1">Testo</option>
    <option value="0">HTML</option>
    </select></td>
    </tr>


    <tr>
    <td width="100%" colspan="2"><input type="submit" value="Invia Newsletter!" name="B1"><input type="reset" value="Reimposta" name="B2"></td>
    </tr>
    </table>
    </form>


    </p>
    <%
    End IF
    Conn.Close
    Set Conn= Nothing
    Set RecSet = Nothing
    %>
    </body>

    </html>
    - las penas sirven por asustar a quines no desean cometer pecados -

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    E l'errore quale sarebbe?

    Roby

  3. #3
    non si apre la pagina.....
    - las penas sirven por asustar a quines no desean cometer pecados -

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Internet Explorer: Menu strumenti --> Opzioni Internet --> Avanzate e declicca la voce "Mostra messaggi di errore HTTP brevi".

    Roby

  5. #5
    Active Server Pages error 'ASP 0126'

    Impossibile trovare il file di inclusione

    /Gestione_Newsletter.asp, line 9

    Impossibile trovare il file di inclusione "../adovbs.inc".


    Ma sono sicura che c'è......
    - las penas sirven por asustar a quines no desean cometer pecados -

  6. #6
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Mettilo nella root del sito e cambia quella riga così:

    Così sei sicura che funziona...

    Roby

  7. #7
    Prima mi diceva che la barra "/" non poteva essere usata. Ora l'ho tolta e mi da :


    > Invia newsletter!

    Oggetto server error 'ASP 0177 : 800401f3'

    Impossibile eseguire il metodo Server.CreateObject

    /Gestione_Newsletter.asp, line 15

    800401f3
    - las penas sirven por asustar a quines no desean cometer pecados -

  8. #8
    questo è il mio global.asa

    <script LANGUAGE="VBScript" RUNAT="Server">

    Sub Session_OnStart

    ' Nome utente della sessione
    Session("UserName") = ""
    ' Password dell' utente della sessione
    Session("Password") = ""
    ' Se True permette agli utenti di autoregistrarsi
    Session("AutoRegistrazione") = True

    ' Questa variabile é utilizzata per ricordarsi la pagina
    ' che ha reindirizzato il controllo ad una sottopagina perché
    ' mancavano dei dati. Questo puo' accadere ad esempio se non
    ' é ancora stato fatto il login e si tenta di fare un ordine.
    ' In questo caso viene fatto un reindirizzamento alla pagina
    ' Password.asp che permette di inserire i dati. Terminato questo
    ' processo, il controllo viene rimandato alla pagina RedirectPage.
    Session("RedirectPage") = ""

    ' **************
    ' INIZIO OPZIONI
    ' **************

    ' Titolo del sito
    Session("TitoloSito") = "Prenotazioni"
    Session("IndirizzoSito") = "www.ffarronato.it"

    ' Percorso dove risiedono i database che contengono i dati
    Session("DBConnectionString") = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" + Server.MapPath("Database\Prenotazioni.Mdb")

    ' FINE OPZIONI
    End Sub

    sub Application_OnStart

    end sub

    Sub Session_OnEnd

    end sub

    </script>

    <html>
    <head>
    <title></title>
    </head>

    <body>
    </body>
    </html>
    - las penas sirven por asustar a quines no desean cometer pecados -

  9. #9
    Ho sistemato la connessione. Questo è il nuovo file gestione_newsletter.aps

    <html>

    <head>
    <title>GESTIONE NEWSLETTER</title>
    </head>

    <body>

    <font size="4" face="Verdana">&gt; Invia newsletter!</font></p>


    <%
    ' LEGGE QUELLO CHE DEVE FARE
    operazione = Request.QueryString("tipo")

    ' PERCORSO DEL DATABASE
    filePath = Server.MapPath("\database\prenotazioni.mdb")
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath
    set recset = Conn.Execute("select EMail FROM Anagrafica")

    ' OPERAZIONE = INVIA IL MESSAGGIO DI NEWSLETTER
    IF operazione = "invia" then

    ' VERIFICA CHE I CAMPI SIANO STATI COMPILATI
    IF Request("oggetto") <> "" and Request("testo") <> "" then

    IF not RecSet.Eof then

    ' INDIRIZZO EMAIL NOSTRO
    mittente = "yyyyyy@yyyyyy.it"

    Do until Recset.eof

    ' PRELEVA L'EMAIL DELL'UTENTE DAL NOSTRO DATABASE
    destinatario = RecSet("email")

    ' PRELEVA IL TESTO DEL MESSAGGIO DA INVIARE
    testo = Request.Form("testo")

    ' PRELEVA L'OGGETTO DEL MESSAGGIO DA INVIARE
    oggetto = Request.Form("oggetto")

    Dim objCDOMail 'Holds the mail server object
    Dim objCDOConf 'Holds the mail server object
    Dim Flds 'Holds the mail server parameters for configuration
    'Create the e-mail server object
    Set objCDOMail = CreateObject("CDO.Message")
    Set objCDOConf = CreateObject("CDO.Configuration")
    Set Flds = objCDOConf.Fields
    with objCDOMail
    Set .Configuration = objCDOConf
    .To = destinatario
    .From = mittente
    .Subject = oggetto
    ' FORMATO EMAIL
    .BodyFormat = Request.Form("formato")
    .MailFormat = Request.Form("formato")

    .HTMLBody = Messaggio

    ' INVIA L'EMAIL E..
    .Send
    End with
    'Close the server object
    Set objCDOMail = Nothing
    Set objCDOConf = Nothing
    Set Flds = Nothing

    ' PASSA AVANTI...
    RecSet.Movenext
    loop

    End If

    RecSet.Close
    Conn.close
    Set RecSet = Nothing
    Set Conn = Nothing

    ' VISUALIZZA UN MESSAGGIO DI CONFERMA:
    %>
    <hr>
    <p align="center"><font face="Verdana" size="4">Messaggio inviati
    correttamente!
    </font></p>
    <hr>
    <%
    Else
    %>
    <hr>
    <p align="center"><font face="Verdana" size="4">Compila tutti i campi!</font></p>
    <hr>
    <%
    End IF
    Else
    %>
    <form method="POST" action="Gestione_Newsletter.asp?tipo=invia">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
    <td width="26%"><font face="Verdana" size="2">Oggetto messaggio:</font></td>
    <td width="74%"><font face="Verdana" size="2"><input type="text" name="oggetto" size="20"></font></td>
    </tr>
    <tr>
    <td width="26%"><font face="Verdana" size="2">Testo messaggio:</font></td>
    <td width="74%"><font face="Verdana" size="2"><textarea rows="6" name="testo" cols="67"></textarea></font></td>
    </tr>
    <tr>
    <td width="26%"><font face="Verdana" size="2">Formato e-mail:</font></td>
    <td width="74%"><select size="1" name="formato">
    <option selected value="1">Testo</option>
    <option value="0">HTML</option>
    </select></td>
    </tr>


    <tr>
    <td width="100%" colspan="2"><input type="submit" value="Invia Newsletter!" name="B1"><input type="reset" value="Reimposta" name="B2"></td>
    </tr>
    </table>
    </form>


    </p>
    <%
    End IF
    Conn.Close
    Set Conn= Nothing
    Set RecSet = Nothing
    %>
    </body>

    </html>


    questo è l'errore
    > Invia newsletter!

    Errore di run-time di Microsoft VBScript error '800a01b6'

    Proprietà o metodo non supportati dall'oggetto: 'Request.Form(...).BodyFormat'

    /Gestione_Newsletter.asp, line 55
    - las penas sirven por asustar a quines no desean cometer pecados -

  10. #10
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Elimina completamente queste righe che con CDOSYS non hanno nulla a che fare:

    codice:
    ' FORMATO EMAIL 
    .BodyFormat = Request.Form("formato") 
    .MailFormat = Request.Form("formato")
    Roby

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.