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>

Rispondi quotando