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>