news letter

AREAFORUM

Nuovo Utente
8 Gen 2006
21
0
0
www.radiovenere.net
Solo Lukeonweb mi puo' aiutare questo script è suo, :love:

allora l'ho modificato in quantoper l'invio delle news letter il mio server utilizza CDOSYS ho apportato le modifiche ma mi da impossibile aprire la pagina

perchè?

aiutatemi vi prego:crying:



Codice:
<%@ LANGUAGE="VBScript" %>
<%Option Explicit%>
<html>
<head>
	<!-- #include file="./DBConnect.inc"-->
</head>
<body>

<%
Dim con, rs, strSql, objMail

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 objMessage = CreateObject("CDO.Message")

'MODIFY the following email address will appear as the from address for the email.
		objMessage.Sender = "redazione@stadioradio.it"
		objMessage.To = rs("Email")
		objMessage.TextBody = Request.Form("txtEmail")
		
		objMessage.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
	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:<br />
			<textarea name="txtEmail" cols="50" rows="30"></textarea><br />
			<input type="submit" name="cmdSubmit" value="Submit">
		</div>
	</form>
<%
End If
%>

</body>
</html>
 
Ma hai mica fatto il copia e incolla di questo script senza aver tenuto conto del database ne tanto meno della connessione contenuta nel file DBConnect.inc?
 
il file inc. è questo

Codice:
<%

Function GetDBConnection()
	Dim strCon
	Set GetDBConnection = Server.CreateObject("ADODB.Connection")
	
'MODIFY the following line includes the location to the newsletter database. 
'  Make sure the "server.mappath" value is correct .
	strCon = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("\mdb-database\newsletter.mdb")

	GetDBConnection.Open strCon
End Function

%>

voglio dire che riesco a iscrivermi alla news letter ed anche a cancellarmi, perciò penso che la connessione con database funzioni!
:crying:
 
:mavieni: :mavieni:

:fonzie:
HO TROVATO "FACILMENTE" IL TUO SCRIPT" L'HO MIDIFICATO E VA CHè è UNA MERAVIGLIA, DEVO SOLO CERCARE DI INSERIRE DELLE RICHE STANDARD CHE ACCOMPAGNI IL CORPO DEL MESSAGGIO.............. CIAO

:byebye: :mavieni: :mavieni:
 
BE ALLORA NE APPROFITTO IL CODICE IN QUESTIONE IL TUO DAVVERO QUESTA VOLTA è QUESTO

Codice:
<%@LANGUAGE = JScript%>
<%
   // Recupero i dati dal modulo
   var username = new String(Request.Form("username"));
   var password = new String(Request.Form("password"));
   var email = new String(Request.Form("email"));
   var oggetto = new String(Request.Form("oggetto"));
   var messaggio = new String(Request.Form("messaggio"));

   // Verifico username e password
   if ((username != "luke") || (password != "prova")) {
        Response.Write("Autorizzazione negata");
        Response.End;
   }

   // Creo la classe CDONTS.NewMail per inviare l'email
   var INVIA = new ActiveXObject("CDO.Message");
   
       // Riempio i campi dell'email
       INVIA.To = "";
       INVIA.Bcc = email;
       INVIA.From = "redazione@stadioradio.it"; // Inserisci il tuo indirizzo email
       INVIA.Subject = oggetto;
       INVIA.TextBody = messaggio;
       
       INVIA.Send();
       
    Response.Write("Newsletter inviata con successo.");
%>

VORREI INSERIRE UN TESTO CHE ACCOMPAGNI LA MAIL PRIMA E DOPO IL MESSAGGIO VERO E PROPRIO, MAGARI MODIFICABILE IMMEDIATAMENTE PRIMA DELL'INVIO..
TI RINGRAZIO ANTICIPATAMENTE
:byebye:
 
INVIA.TextBody = messaggio;

la variabile "messaggio" la prendi da una textarea, in cui puoi inserire il testo che vuoi... no?

forse cosi è troppo facile per essere la soluzione al tuo problema, quindi, probabilmente, il problema non l'ho capito :)

fammi sapere ;)
 
be allora vorrei fare una cosa del genere

var messaggio = ""testo di apertura news letter" + new String(Request.Form("messaggio")) + ""testo di chiusura news letter"";

ma tradotto in linguaggio comprensibile per il server?

:confused: :D
 

Discussioni simili