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

    problema con mailing list

    ciao
    ho scaricato uno script per una mailing list.
    tutto bene.
    metto l'indirizzo email, faccio la registrazione, mi esce una pagina in cui mi die che mi arriverà una mail per confermare la mia registrazione...ma l'email non è mai arrivata.

    mi date un consiglio?
    vi posto il codice delle pagine
    grazie mille a tutti

    NEWSLETTER.ASP (la pagina da cui faccio l'iscrizione)
    <html>
    <head>
    <title>NewsLetter</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <div align="center">



    <span style="font-family:arial;font-size:12px;color:#000080;font-weight:bold">Enter your Email address below to subscribe to our Newsletter</span>

    <form action="proccess.asp" method="post">
    <input type="hidden" name="confirm" value="no" />
    <table width="75%" align="center">
    <tr>
    <td align="center"><input type="text" name="email" size="20" /></td>
    </tr>
    <tr>
    <td align="center"><input type="submit" value="Subscribe" /></td>
    </tr>
    </table>
    </form>
    </div>
    </body>
    </html>




    CONFIG.ASP
    <%
    Dim objConn, strDBPath, strDomain, smtpServer, strLink
    Dim fromAddr, mailComp, strSiteTitle, strFooter

    'Change to the title of your site IE: HTMLJunction
    strSiteTitle = "Paolo Chiari"
    'The address to your website WITHOUT "http://"
    strDomain = "www.paolochiari.it"

    'Customize the footer that gets inserted at the bottom of the newsletter
    If Request.Form("version") = "html" Then 'html link
    strLink = "<a href=""http://" & strDomain & "/newsletter/proccess.asp?cancel=now"">" & _
    "http://" & strDomain & "/newsletter/proccess.asp?cancel=now</a>"
    Else ' text link
    strLink = "http://" & strDomain & "/newsletter/proccess.asp?cancel=now</a>"
    End If
    strFooter = "

    If you would like to be removed from this mailing list
    " & _
    "Click on the link below or copy and paste it to your browser." & _
    "

    " & strLink & "

    " & _
    "Thanks
    " & strSiteTitle

    'Your mail server
    smtpServer = "mail.191.it"
    'your email address on the mail server
    fromAddr = "fabio@paolochiari.it"

    'Select your email component
    mailComp = "CDOSYS"
    'mailComp = "CDONTS"
    'mailComp = "JMail"
    'mailComp = "ASPMail"

    'database path
    strDBPath = "/mdb-database/newsletter.mdb"

    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
    "Data Source = " & Server.MapPath(strDBPath) & ";" & _
    "User Id=Admin;" & _
    "Password="
    %>

    MAIL.ASP


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Newsletter - Send Mail</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <%
    Dim rsNews, recipients, strCount
    Set rsNews = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM newsLetter WHERE confirm = 'yes';"
    rsNews.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText
    strCount = 0
    If Not rsNews.EOF Then
    Do While Not rsNews.EOF
    recipients = recipients & rsNews("email") & ","
    strCount = strCount + 1
    rsNews.MoveNext
    Loop
    recipients = Left(recipients,Len(recipients)-1)
    End If
    rsNews.Close
    Set rsNews = Nothing

    If Request.Form("action") = "" Then
    %>
    <div align="center">



    <form action="mail.asp" method="post">
    <input type="hidden" name="purge" value="yes" />
    Purge Database<input type="submit" value="Yes" />
    </form>



    <span style="font-family:arial;font-size:12px;color:#000080;font-weight:bold">
    There are <%= strCount %> members in your mailing list.
    </span>



    <form action="mail.asp" method="post">
    <input type="hidden" name="action" value="send" />
    <input type="hidden" name="recipients" value="<%= recipients %>" />
    <table width="50%">
    <tr>
    <td><span class="thrd">Subject:</span><input type="text" name="nwsubject" size="30" value="Newsletter" /></td>
    </tr>
    <tr>
    <td>
    <textarea name="msg" cols="50" rows="10"></textarea>
    </td>
    </tr>
    <tr>




    PROCCESS.ASP


    <%
    Dim rsNews, strEmail, strConfirm, strSQL

    strEmail = Trim(Request("email"))
    strConfirm = Trim(Request("confirm"))


    If strConfirm = "yes" Then 'confirm the subscription
    Set rsNews = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM newsLetter WHERE email = '" & strEmail & "';"
    rsNews.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText
    rsNews("confirm") = strConfirm
    rsNews.Update
    Response.Write "<div align=""center"">

    " & _
    "<span style=""font-family:arial;font-size:12px;color:#000080;font-weight:bold;text-align:left"">" & _
    "Success! " & rsNews("email") & " has been confirmed!" & _
    "

    Thank you for subscribing to the " & strSiteTitle & " newsletter

    </span></div>"
    rsNews.Close
    Set rsNews = Nothing
    ElseIf strConfirm = "no" Then 'New subscriber
    Set rsNews = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM newsLetter WHERE email = '" & strEmail & "';"
    rsNews.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText

    If NOT rsNews.EOF Then
    Response.Write "<div align=""center"">This email address is already subscribed!</div>"
    rsNews.Close
    set rsNews = Nothing
    Else

    strSQL = "INSERT INTO newsletter ([email],[Date],[confirm]) VALUES('" & strEmail & "','" & Now & "','" & strConfirm & "')"
    objConn.Execute strSQL
    Set rsNews = Server.CreateObject("ADODB.Recordset")
    rsNews.Open "newsLetter", objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable

    Response.Write "<div align=""center"">

    " & _
    "<span style=""font-family:arial;font-size:12px;color:#000080;font-weight:bold;text-align:left"">" & _
    "An email has been sent to:

    " & strEmail & "

    " & _
    "Confirm your subscription by following the instructions in the email" & _
    "

    Thank for subscribing to the " & strSiteTitle & " Newsletter</span></div>"

    dim mailObj, cdoMessage, cdoConfig, addrList, strEmailMsg, subject
    subject = strSiteTitle & " Newsletter confirmation"
    'send email so subscriber can confirm
    strEmailMsg = "Thank you for subscribing to the " & strSiteTitle & " Newsletter

    " & _
    "Please confirm your subscription by clicking on the link below.

    " & _
    "<a href=""http://" & strDomain & "/newsletter/proccess.asp?email=" & strEmail & "&confirm=yes"">" & _
    "http://" & strDomain & "/newsletter/proccess.asp?email=" & strEmail & "&confirm=yes</a>

    " & _
    "You received this email because you submitted this email address to our mailing list.
    " & _
    "If you did not subscribe or wish to be removed from our list - click on the link below

    " & _
    "<a href=""http://" & strDomain & "/newsletter/proccess.asp?email=" & strEmail & "&cancel=yes"">" & _
    "http://" & strDomain & "/newsletter/proccess.asp?email=" & strEmail & "&cancel=yes</a>

    " & _
    "Our Thanks
    " & strSiteTitle

    'Send email based on mail component.

    'Send email (CDONTS version). Note: CDONTS doesn't support a reply-to
    'address and has no error checking.

    if mailComp = "CDONTS" then
    set mailObj = Server.CreateObject("CDONTS.NewMail")
    mailObj.BodyFormat = 0
    mailObj.MailFormat = 0
    mailObj.From = fromAddr
    mailObj.To = strEmail
    mailObj.Subject = subject
    mailObj.Body = strEmailMsg
    mailObj.Send
    set mailObj = Nothing
    end if

    'Send email (CDOSYS version).

    if mailComp = "CDOSYS" then
    set cdoMessage = Server.CreateObject("CDO.Message")
    set cdoConfig = Server.CreateObject("CDO.Configuration")
    cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
    cdoConfig.Fields.Update
    set cdoMessage.Configuration = cdoConfig
    cdoMessage.From = fromAddr
    cdoMessage.To = strEmail
    cdoMessage.Subject = subject
    cdoMessage.HtmlBody = strEmailMsg
    on error resume next
    cdoMessage.Send
    if Err.Number <> 0 then
    SendMail = "Email send failed: " & Err.Description & "."
    end if
    set cdoMessage = Nothing
    set cdoConfig = Nothing
    end if

    'Send email (JMail version).

    if mailComp = "JMail" then
    set mailObj = Server.CreateObject("JMail.SMTPMail")
    mailObj.Silent = true
    mailObj.ServerAddress = smtpServer
    mailObj.Sender = fromAddr
    mailObj.ReplyTo = fromAddr
    mailObj.Subject = subject
    mailObj.AddRecipient strEmail
    mailObj.ContentType = "text/html"
    mailObj.Body = strEmailMsg
    if not mailObj.Execute then
    SendMail = "Email send failed: " & mailObj.ErrorMessage & "."
    end if
    end if

    'Send email (ASPMail version).

    if mailComp = "ASPMail" then
    set mailObj = Server.CreateObject("SMTPsvg.Mailer")
    mailObj.FromAddress = fromAddr
    mailObj.RemoteHost = smtpServer
    mailObj.ReplyTo = fromAddr
    mailObj.AddRecipient "", strEmail
    mailObj.Subject = subject
    mailObj.ContentType = "text/html"
    mailObj.BodyText = strEmailMsg
    if not mailObj.SendMail then
    SendMail = "Email send failed: " & mailObj.Response & "."
    end if
    end if
    rsNews.Close
    Set rsNews = Nothing
    End If
    Else
    If Request("cancel") = "yes" Then
    Set rsNews = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM newsLetter WHERE email = '" & strEmail & "';"
    rsNews.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText

    If not rsNews.EOF Then
    rsNews.Delete
    Response.Write "<div align=""center"">

    " & _
    "<span style=""font-family:arial;font-size:12px;color:#000080;font-weight:bold;text-align:left"">" & _
    " Success! " & strEmail & " has been removed from our database" & _
    "

    Sorry to see you go!</span></div>"
    End If
    rsNews.Close
    Set rsNews = Nothing
    Else
    %>
    <div align="center">



    <span style="font-family:arial;font-size:12px;color:#000080;font-weight:bold">
    Enter the email address you want removed.</span>


    <form action="proccess.asp" method="post">
    <input type="hidden" name="cancel" value="yes" />
    <table width="75%" align="center">
    <tr>
    <td align="center"><input type="text" name="email" size="20" /></td>
    </tr>
    <tr>
    <td align="center"><input type="submit" value="Remove" /></td>
    </tr>
    </table>
    </form>
    </div>
    <%
    End If
    End If
    objConn.Close
    Set objConn = Nothing
    %>
    Matrix has you!!

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Prova a mettere come mittente del messaggio un indirizzo di posta riconosciuto dal server SMTP.
    Cioè se mandi una mail dal dominio "pippo.it" la mail del mittente deve essere ad esempio info@pippo.it

    Quindi, nel caso di CDONTS, cambia questa:

    mailObj.From = fromAddr

    Lo stesso nel caso usassi gli altri componenti di invio.

    Roby

  3. #3
    ciao
    ho provato ma non va cmq.
    ho ripiegato su un altro script.
    ti chiedo gentilmente di aiutarmi anche in qsto casa se hai tempo e voglia.
    ti spiego
    con lo script che ho trovato è possibile raccogliere in un file .mdb le email delle persone che si registrano alla mailing list.
    vorrei però che oltre alle email mi raccogliesse anche il nome e cognome.
    come potrei fare.
    ti dico subito che io di asp non so praticamente nulla...
    ti listo qui di seguito il codice dei file:

    ISCRIZIONE.ASP

    <%@LANGUAGE = JScript%>
    <%
    /*
    Autore: Luca Ruggiero - http://www.lukeonweb.net
    Fonte: freeAsp.it - http://freeasp.html.it
    */

    // Istanzio una variabile che mi permette di verificare l'inserimento
    var errore = 0;

    // Recupero l'indirizzo email segnalato e l'azione dell'utente,
    // ovvero l'intenzione di iscriversi o di cancellarsi
    var email = new String(Request.Form("email"));
    var azione = new String(Request.Form("azione"));

    // Espressione regolare per un indirizzo email
    var Controlla = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;

    // Apro la connessione al database
    var Cn = new ActiveXObject("ADODB.Connection");
    var Sc = "driver={Microsoft Access Driver (*.mdb)};dbq=" + Server.MapPath("/mdb-database/database.mdb");
    Cn.Open(Sc);

    // Verifico se l'indirizzo email è già presente
    var Ridondanza = Cn.Execute("SELECT * FROM utenti WHERE email LIKE '" + email + "'");

    // Caso in cui l'utente decide di registrarsi
    if (azione == "S") {
    // Imposto le condizioni per la verifica
    if (!Controlla.test(email)) {
    errore = 1;
    }
    if (!Ridondanza.EOF) {
    errore = 2;
    }

    // Organizzo l'output per i mesaggi di errore
    if (errore == 1) {
    Response.Write("Inserisci un indirizzo email corretto");
    Cn.Close();
    Response.End;
    }
    if (errore == 2) {
    Response.Write("Sei già iscritto alla Mailing list");
    Cn.Close();
    Response.End;
    }

    // Apro il recordset ed effettuo l'inserimento
    var Rs = new ActiveXObject("ADODB.Recordset");

    Rs.Open("utenti",Cn,3,3);
    Rs.AddNew();
    Rs("email") = email;
    Rs.Update();
    Rs.Close();

    Response.Write("Iscrizione avvenuta con successo");
    }

    // Caso in cui l'utente già registrato decide di cancellarsi
    if (azione == "N") {
    // Imposto i casi di errore in fase di cancellazione
    if (Ridondanza.EOF) {
    errore = 3;
    }

    // Organizzo l'output per i mesaggi di errore
    if (errore == 3) {
    Response.Write("Indirizzo email inesistente: impossibile effettuare la cancellazione");
    Cn.Close();
    Response.End;
    }

    var Cancella = Cn.Execute("DELETE * FROM utenti WHERE email LIKE '" + email + "'");

    Response.Write("Cancellazione avvenuta con successo");
    }

    Cn.Close();


    NEWSLETTER.ASP

    <%@LANGUAGE = JScript%>
    <%
    // Apro la connessione al database
    var Cn = new ActiveXObject("ADODB.Connection");
    var Sc = "driver={Microsoft Access Driver (*.mdb)};dbq=" + Server.MapPath("/mdb-database/database.mdb");
    Cn.Open(Sc);

    // Estraggo gli indirizzi email dal database
    var utenti = Cn.Execute("SELECT email FROM utenti");

    // Costruisco il form Html per l'invio della Mailing list
    Response.Write("<form method='post' action='invia.asp'>");
    Response.Write("<input type='hidden' name='email' value='");
    // Estraggo tutti gli indirizzi email dal database
    while (!utenti.EOF) {
    Response.Write(utenti("email") + ",");
    utenti.MoveNext();
    }
    Response.Write("' style='width:100%;'>");
    Response.Write("Invio della Mailing list

    ");
    Response.Write("Username
    <input type='text' name='username' style='width:100%;'>
    ");
    Response.Write("Password
    <input type='password' name='password' style='width:100%;'>
    ");
    Response.Write("Oggetto
    <input type='text' name='oggetto' style='width:100%;'>
    ");
    Response.Write("Messaggio
    <textarea name='messaggio' rows='15' style='width:100%;'></textarea>
    ");
    Response.Write("<input type='submit' value='INVIA' style='width:100%;'>");
    Response.Write("</form>");

    Cn.Close();
    %>


    il file database.mdb ha il solo campo email.

    grazie mille
    fabio
    Matrix has you!!

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Innanzitutto devi mettere nella tabella del db anche gli altri due campi.
    Il form dell'iscrione dell'utente dovrà accogliere anche nome e cognome e questi dovranno finire nel db.
    Insomma devi lavorarci un po'.

    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.