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

Discussione: Newsletter, objMail.To

  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2003
    Messaggi
    119

    Newsletter, objMail.To

    Ho un problema con objMail.To
    Type_mismatch:_'To'

    Mi aiuta qualcuno?
    ----------------------------------------------------

    <html>
    <head>

    </head>
    <body>

    <%


    If Request.Form("cmdSubmit") <> "" Then
    'The user has submitted the page, so process the Newsletter subscription request

    Set Conn= Server.CreateObject("Adodb.connection")
    Conn.Open "provider=microsoft.jet.oledb.4.0; data source="& Server.MapPath("db/newsletter.mdb")
    set rs = server.CreateObject("Adodb.recordset")
    sql = "SELECT email FROM spedizione"
    rs.open "spedizione", conn,1,2
    rs("email") = email
    If rs.EOF Then

    'MODIFY the text below displays when no subscribers exist
    %>
    There are no subscribers to the newsletter.
    <%
    'Clean up database objects
    rs.Close()
    Set rs = Nothing
    conn.Close()
    Set conn = Nothing

    Response.End
    End If

    While Not(rs.EOF)

    Dim objMail
    dim objconf
    Set objMail = CreateObject("CDO.Message")
    Set objconf = CreateObject("CDO.Configuration")
    Const NAMESPACE = "http://schemas.microsoft.com/cdo/configuration/"
    Const cdoSendUsingPort = 2
    objconf.Fields(NAMESPACE & "sendusing") = cdoSendUsingPort
    objconf.Fields(NAMESPACE & "smtpserver") = "mioserver"
    objconf.Fields(NAMESPACE & "smtpserverport") = 25
    objconf.Fields.Update
    objMail.Configuration = objconf

    objMail.TextBody = Request.Form("txtEmail")

    'MODIFY the following email address will appear as the from address for the email.
    objMail.From = "newsletter@miosito.it"
    objMail.To = rs("email")

    objMail.Subject = "Newsletter"

    objMail.Send

    rs.MoveNext()
    Wend

    'MODIFY the text below displays when all the emails have been sent
    %>
    The emails have been sent.
    <%

    'Clean up database objects
    rs.Close()
    Set rs = Nothing
    conn.Close()
    Set conn = Nothing

    Else

    'MODIFY the text below is displayed when the page is first loaded.
    %>
    <form action="send.asp" method="post" id=form1 name=form1>
    <div align="center">
    Enter the email message to send:

    <textarea name="txtEmail" cols="50" rows="30"></textarea>

    <input type="submit" name="cmdSubmit" value="Submit">
    </div>
    </form>
    <%
    End If
    %>

    </body>
    </html>

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Potresti avere qualche campo email vuoto...

    Roby

  3. #3
    Utente di HTML.it
    Registrato dal
    Jan 2003
    Messaggi
    119

    Name_redefined:_'NAMESPACE'

    Ora le newsletter le invia per la pagina mi
    dà un errore Name_redefined:_'NAMESPACE'

    Che significa?

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Hai ridefinito con la DIM due volte la stessa variabile.
    Le DIM toglile dal Loop, una sola volta si definiscono le variabili.

    Roby

  5. #5
    Utente di HTML.it
    Registrato dal
    Jan 2003
    Messaggi
    119

    Dim

    Puoi dirmi per favore con precisione da dove devo torglierla,
    perché sto facendo varie prove e le nwsletter non arrivano
    al destinario.

    Grazie

  6. #6
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Quello è tutto lo script?
    Non c'è altro?
    Vediamo l'ultima versione.

    Roby

  7. #7
    Utente di HTML.it
    Registrato dal
    Jan 2003
    Messaggi
    119
    If Request.Form("cmdSubmit") <> "" Then
    'The user has submitted the page, so process the Newsletter subscription request

    Set Conn= Server.CreateObject("Adodb.connection")
    Conn.Open "provider=microsoft.jet.oledb.4.0; data source="& Server.MapPath("db/newsletter.mdb")
    set rs = server.CreateObject("Adodb.recordset")
    sql = "SELECT email FROM spedizione "
    set rs = conn.execute(sql)

    Dim objMail
    dim objconf
    Set objMail = CreateObject("CDO.Message")
    Set objconf = CreateObject("CDO.Configuration")
    Const NAMESPACE = "http://schemas.microsoft.com/cdo/configuration/"
    Const cdoSendUsingPort = 2
    objconf.Fields(NAMESPACE & "sendusing") = cdoSendUsingPort
    objconf.Fields(NAMESPACE & "smtpserver") = "mioserver"
    objconf.Fields(NAMESPACE & "smtpserverport") = 25
    objconf.Fields.Update
    objMail.Configuration = objconf

    'MODIFY the following email address will appear as the from address for the email.
    objMail.From = "newsletter@miosito.it"
    objMail.To = rs("email")

    objMail.Subject = "Newsletter miosito"
    'in testohtml devi inserire l'html della mail



    objMail.HTMLBody = testoHtml

    objMail.Send()

    %>




    <%
    If rs.EOF Then

    'MODIFY the text below displays when no subscribers exist
    %>
    There are no subscribers to the newsletter.
    <%
    'Clean up database objects
    rs.Close()
    Set rs = Nothing
    conn.Close()
    Set conn = Nothing

    Response.End
    End If

    While Not(rs.EOF)%>

    <%

    rs.MoveNext()
    Wend

    'MODIFY the text below displays when all the emails have been sent
    %>
    The emails have been sent.
    <%

    'Clean up database objects
    rs.Close()
    Set rs = Nothing
    conn.Close()
    Set conn = Nothing

    Else

    'MODIFY the text below is displayed when the page is first loaded.
    %>
    <form action="newsletter_send.asp" method="post" id=form1 name=form1>
    <div align="center">
    Enter the email message to send:


    <input type="submit" name="cmdSubmit" value="Submit">
    </div>
    </form>
    <%
    End If
    %>

    </body>
    </html>

  8. #8
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    :master:

    Vedo parti duplicate ma senza senso...

    Roby

  9. #9
    Utente di HTML.it
    Registrato dal
    Jan 2003
    Messaggi
    119

    Name_redefined:_'NAMESPACE'

    Ciao Roby,
    ho seguito i tuoi consigni, ma la pagina mi da sempre lo stesso errorr: Name_redefined:_'NAMESPACE'
    In sostanza, la newsletter parte ma arriva solo alla mail
    del primo record del db.


    <%
    dim objMail
    dim objconf
    Set Conn= Server.CreateObject("Adodb.connection")
    Conn.Open "provider=microsoft.jet.oledb.4.0; data source="& Server.MapPath("db/newsletter.mdb")
    strSql=" select email from spedizione"
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open "spedizione", conn, 2, 2

    'set rs = conn.execute(sql)

    If rs.EOF Then
    %>
    There are no subscribers to the newsletter.
    <%
    'Clean up database objects
    rs.Close()
    Set rs = Nothing
    conn.Close()
    Set conn = Nothing

    Response.End
    End If
    While NOT rs.EOF

    Set objMail = CreateObject("CDO.Message")
    Set objconf = CreateObject("CDO.Configuration")
    Const NAMESPACE = "http://schemas.microsoft.com/cdo/configuration/"
    Const cdoSendUsingPort = 2
    objconf.Fields(NAMESPACE & "sendusing") = cdoSendUsingPort
    objconf.Fields(NAMESPACE & "smtpserver") = "localhost"
    objconf.Fields(NAMESPACE & "smtpserverport") = 25
    objconf.Fields.Update
    objMail.Configuration = objconf

    objMail.From = "newsletter@miosito.it"
    objMail.To = rs("email")
    objMail.Subject = "Newsletter"

    objMail.HTMLBody = testoHtml

    objMail.Send()

    rs.MoveNext()
    Wend

    %>
    The emails have been sent.


    <%
    rs.close()
    set rs = nothing
    conn.close()
    set conn = nothing
    %>

  10. #10
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Const NAMESPACE = "http://schemas.microsoft.com/cdo/configuration/"
    Const cdoSendUsingPort = 2

    togli i Const

    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.