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

    passaggio da Cdonts a cdosys

    While Not(rs.EOF)
    Set objMail = Server.CreateObject("CDONTS.NewMail")

    'MODIFY the following email address will appear as the from address for the email.
    objMail.From = "newsletter@yoursite.com"
    objMail.To = rs("Email")
    objMail.Body = Request.Form("txtEmail")

    objMail.Send

    rs.MoveNext()
    Wend

    il server non supporta cdonts, per passare a cdosys? Cosa devo modificare nel codice?

  2. #2

  3. #3
    qualcuno mi aiuta a riconfigurare il mio script?

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    In che senso? Ti ho linkato degli esempi... Devi solo mettere le tue variabili.

    Roby

  5. #5
    pardon volevo rispondere ad un altro topic, vado a leggere gli esempi

  6. #6
    ho modificato lo script però non riesco ad inviare l'email, ricevo questo errore:
    Tipo di errore: (0x8004020F)
    /3103/newsletter/send.asp, line 56


    browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
    Pagina: POST 30 bytes to /3103/newsletter/send.asp

    POST Data: txtEmail=ciao&cmdSubmit=Submit
    Ora: Tuesday, May 10, 2005, 4:15:52 PM
    ------
    questo è il mio codice:

    <%@ LANGUAGE="VBScript" %>
    <%Option Explicit%>
    <html>
    <head>

    </head>
    <body>

    <%
    Dim con, rs, strSql, objMail, objConfig


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

    'Connect to the database
    Set con = GetDBConnection()

    'Get all email addresses in the database
    strSql = "SELECT Email FROM Subscribers"
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open strSql, con, 1, 2

    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
    con.Close()
    Set con = Nothing

    Response.End
    End If

    While Not(rs.EOF)
    Set objMail = createObject("CDO.Message")
    Set objConfig = Server.createObject("CDO.Configuration")
    With objConfig

    .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.cosec.it"
    .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
    .Fields.update
    End With
    Set objMail.Configuration = objConfig
    objMail.From = "newsletter@yoursite.com"
    objMail.To = rs("Email")
    objMail.HTMLBody = Request.Form("txtEmail")
    objMail.Fields("urn:schemas:httpmail:importance"). Value = 2
    objMail.Fields.update()
    objMail.Send()
    Set objMail = Nothing
    rs.MoveNext()
    Wend
    %>
    The emails have been sent.
    <%
    'Clean up database objects
    rs.Close()
    Set rs = Nothing
    con.Close()
    Set con = 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>

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.