HO TRASFORMATO IL PRIMO CODICE IN CDONTS NEL SECONDO IN CDSYS MA NON FUNZIONA...
QUALCUNO MI SA AIUTARE?
codice:<%@LANGUAGE = JScript%> <% /* Autore: Luca Ruggiero - http://www.lukeonweb.net Fonte: freeAsp.it - http://freeasp.html.it */ var destinatario = "xxxxx@xxxx.it"; // Inserisci qui il tuo indirizzo email // Recupero i dati dal modulo var nome = new String(Request.Form("nome")); var cognome = new String(Request.Form("cognome")); var email = new String(Request.Form("email")); var oggetto = new String(Request.Form("oggetto")); var importanza = new String(Request.Form("importanza")); var messaggio = new String(Request.Form("messaggio")); var html = new String(Request.Form("html")); // RegExp per l'email var valida = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/; // Imposto la data var oggi = new Date(); var data = oggi.getDate() + "/" + (oggi.getMonth() + 1) + "/" + oggi.getYear() + " alle ore " + oggi.getHours() + ":" + oggi.getMinutes(); // Imposto l'indirizzo IP del mittente var ip = Request.ServerVariables("REMOTE_ADDR"); // Controllo la validità dei campi if ((nome == "") || (nome == "undefined")) Response.Redirect("errore.htm?id=1"); if ((cognome == "") || (cognome == "undefined")) Response.Redirect("errore.htm?id=2"); if (!valida.test(email)) Response.Redirect("errore.htm?id=3"); if ((oggetto == "") || (oggetto == "undefined")) Response.Redirect("errore.htm?id=4"); if ((messaggio == "") || (messaggio == "undefined")) Response.Redirect("errore.htm?id=5"); // Creo la classe CDONTS.NewMail ed invio l'email var OggettoCDONTS = new ActiveXObject("CDONTS.NewMail"); OggettoCDONTS.Importance = importanza; OggettoCDONTS.From = email; OggettoCDONTS.To = destinatario; OggettoCDONTS.Subject = oggetto; // Verifica se la mail è in formato Html if ((html == "") || (html == "undefined")) { OggettoCDONTS.BodyFormat = 1; OggettoCDONTS.MailFormat = 1; OggettoCDONTS.Body = "Dati del mittente\n\nNome: " + nome + "\nCognome: " + cognome + "\nEmail: " + email + "\nIP: " + ip + "\n\nMessaggio spedito il " + data + "\n\nQuesto è il corpo del messaggio:\n\n" + messaggio; } else { OggettoCDONTS.BodyFormat = 0; OggettoCDONTS.MailFormat = 0; OggettoCDONTS.Body = "Dati del mittente Nome: " + nome + " Cognome: " + cognome + " Email: " + email + " IP: " + ip + " Messaggio spedito il " + data + " Questo è il corpo del messaggio: " + messaggio; } OggettoCDONTS.Send(); // Reindirizzo il mittente verso la pagina di conferma Response.Redirect("conferma.htm"); %>
mi da errore nella linea in rossocodice:<%@LANGUAGE = JScript%> <% /* Autore: Luca Ruggiero - http://www.lukeonweb.net Fonte: freeAsp.it - http://freeasp.html.it */ var destinatario = "xxxxxxxx@xxxxx.it"; // Inserisci qui il tuo indirizzo email // Recupero i dati dal modulo var nome = new String(Request.Form("nome")); var cognome = new String(Request.Form("cognome")); var email = new String(Request.Form("email")); var oggetto = new String(Request.Form("oggetto")); var importanza = new String(Request.Form("importanza")); var messaggio = new String(Request.Form("messaggio")); var html = new String(Request.Form("html")); // RegExp per l'email var valida = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/; // Imposto la data var oggi = new Date(); var data = oggi.getDate() + "/" + (oggi.getMonth() + 1) + "/" + oggi.getYear() + " alle ore " + oggi.getHours() + ":" + oggi.getMinutes(); // Imposto l'indirizzo IP del mittente var ip = Request.ServerVariables("REMOTE_ADDR"); // Controllo la validità dei campi if ((nome == "") || (nome == "undefined")) Response.Redirect("errore.htm?id=1"); if ((cognome == "") || (cognome == "undefined")) Response.Redirect("errore.htm?id=2"); if (!valida.test(email)) Response.Redirect("errore.htm?id=3"); if ((oggetto == "") || (oggetto == "undefined")) Response.Redirect("errore.htm?id=4"); if ((messaggio == "") || (messaggio == "undefined")) Response.Redirect("errore.htm?id=5"); // Creo la classe CDONTS.NewMail ed invio l'email Set objCDOSYSMail = Server.CreateObject("CDO.Message") Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration") objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 objCDOSYSCon.Fields.Update 'Update the CDOSYS Configuration Set objCDOSYSMail.Configuration = objCDOSYSCon objCDOSYSMail.From = email objCDOSYSMail.To = destinatario objCDOSYSMail.Subject = oggetto 'Set the e-mail body format (HTMLBody=HTML TextBody=Plain) objCDOSYSMail.HTMLBody = ""Dati del mittente\n\nNome: " + nome + "\nCognome: " + cognome + "\nEmail: " + email + "\nIP: " + ip + "\n\nMessaggio spedito il " + data + "\n\nQuesto è il corpo del messaggio:\n\n" + messaggio s.n.c." objCDOSYSMail.Send Set objCDOSYSMail = Nothing Set objCDOSYSCon = Nothing // Reindirizzo il mittente verso la pagina di conferma Response.Redirect("conferma.htm"); %>

Rispondi quotando