[risolto] Invio scheda dettagliata in mail

stralis66

Nuovo Utente
30 Mar 2014
6
0
0
Buongiorno a tutti e complimenti per il lavoro che fate...
E' pochissimo tempo che mi dedico ad asp, essendo da sempre orientato su php avrei quindi necessità di un vostro aiutino. Ho per le mani un sito di un agenzia immobiliare, nella pagina di visualizzazione delle varie schede dovrei aggiungere una "richiesta info" (form precompilato con dettagli)oppure invio mail di tutta scheda. Qualcuno gentilmente mi darebbe una dritta? Vi ringrazio.
Paolo
 

Paolo69

Moderatore
Membro dello Staff
MOD
18 Feb 2010
555
13
18
Italy
www.caprioli.info
...se non hai fretta nel pomeriggio o domani ti pubblico uno script.
Mi elenchi i campi che ti interessano che siano presenti e se lo pubblichi con un iframe o una pagina a se...

Paolo
 

Paolo69

Moderatore
Membro dello Staff
MOD
18 Feb 2010
555
13
18
Italy
www.caprioli.info
Ciao stralis66,
prova questo codice, funziona benissimo:

Codice:
<script language="javascript">
<!--
function accetta(el){
checkobj=el
	if (document.all||document.getElementById){
		for (i=0;i<checkobj.form.length;i++){  
var tempobj=checkobj.form.elements[i]
	if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
							}
						}
					}
function disabilita(el){
	if (!document.all&&!document.getElementById){
			if (window.checkobj&&checkobj.checked)
return true
		else{
alert(" Compilare i campi obbligatori /n All fields required")
return false
						}
					}
				}
-->
</script>
<table align="center" border="0" cellpadding="3" cellspacing="1" width="550" style="font-family:Verdana; font-size:10px">
    <tr>
    <td align="left" style="color:#FFFFFF; background-color:#333333" colspan="2">&nbsp;Contatti</td>
    </tr><%

' ------------------
' Configurazione SMTP
Dim cSmtpServer, cSmtpPort, cSMTPUser, cSMTPPassword
Dim nomedominio, indirizzoIp, modulo, browserSistemaOperativo
Dim oggetto_email, mittente, destinatario
' ------------------
' SETUP
' INFORMAZIONI DA PERSONALIZZARE
	cSmtpServer 	= "smtp.miodominio.it"
	cSmtpPort 		= "25"
	cSMTPUser		= ""
	cSMTPPassword 	= ""
' ------------------
	oggetto_email 	= "Richiesta informazioni"
	mittente 		= "[email protected]"
	destinatario 	= "[email protected]"
' ------------------
' VARIABILI NON UTILIZZATE IN QUESTO SCRIPT
	nomeDominio 				= Request.ServerVariables("HTTP_HOST")
	indirizzoIp					= Request.ServerVariables("REMOTE_ADDR") 
	modulo						= Request.ServerVariables("HTTP_REFERER")
	browserSistemaOperativo		= Request.ServerVariables("HTTP_USER_AGENT")
' ------------------

	showRating = true
	thankYouMessage = "<tr><td align=left colspan=2>Grazie %nome% %cognome% per aver utilizzato il servizio!<br />La seguente richiesta stata inoltrata allo Staff preposto al nostro sistema web:<br /><br />Nome - %nome% <br />Cognome - %cognome%<br />Indirizzo email - %email% <br />Oggetto - %oggetto% <br />Messaggio - %messaggio%</td></tr>"	
	errorMessage = "Attenzione! correggi i seguenti errori:"

	function clearUnSafeTags(s)
		dim re
		Set re = New RegExp
		're.Pattern = "(<( )*\/{0,1}( )*(?!b|i|u|p|a|ul|li|ol)[^>]*>)"
		re.Pattern = "<(?!b>|\/b>|br>|li>|\/li>|i>|\/i>|u>|\/u>)[^>]*>"
		re.Global = true
		re.IgnoreCase = true
		clearUnSafeTags = re.replace(s, "")
	end function

	function IsEmail(strEmail)
		Dim strTemp
		strEmail = CStr(strEmail)
		IsEmail = false
		if not InStr(strEmail, "@") > 0 then
			exit function
		end if
		if not InStr(strEmail, ".") > 0 then
			exit function
		end if
		if not Len(Left(strEmail, Instr(strEmail, "@") - 1)) => 3 then
			exit function
		end if
		strTemp = Mid(strEmail, InStr(strEmail, "@") + 1, Len(strEmail))
		if not Len(Left(strTemp, InStr(strTemp, ".") - 1)) => 3 then
			exit function
		end if
		if not Len(Right(strTemp, Len(strTemp) - Instr(strTemp, "."))) => 2 then
			exit function
		end if
		IsEmail = true
	end function

	If Request("submit") <> "" Then
		
		dim errors(4)
		errored = false
		
		if request("nome") = "" then
			errors(0) = "Prego inserisci il tuo nome"
			errored = true
		end if
		if request("email") = "" then
			errors(1) = "Prego inserisci il tuo indirizzo email"
			errored = true
		end if
		if request("email") <> "" and not IsEmail(request("email")) then
			errors(1) = "Prego <b>correggi</b> il tuo indirizzo email"
			errored = true
		end if
		if request("oggetto") = "" then
			errors(2) = "Prego inserisci l'oggetto della richiesta"
			errored = true
		end if
		if request("messaggio") = "" then
			errors(3) = "Prego inserisci il messaggio"
			errored = true
		end if
		
		if not errored then


' dichiaro le variabili dei form
	nome 		= clearUnSafeTags(request("nome"))
	cognome 	= clearUnSafeTags(request("cognome"))
	email 		= clearUnSafeTags(request("email"))
	oggetto 	= clearUnSafeTags(request("oggetto"))
	messaggio 	= Replace(Replace(Request.Form("messaggio"), chr(13), "<BR>", 1) , "'", "′")

		' Windows XP / 2003 
			Set myMail			=  CreateObject("CDO.Message")
				myMail.Subject 	= oggetto_email ' oggetto
				myMail.From		= mittente ' mittente
				myMail.To		= destinatario ' destinatario
			'	myMail.bCC 		= "[email protected]" 'destinatario nascosto		
				myMail.HTMLBody	= "<body><p>Questa mail &egrave; stata generata da un computer, eventuali risposte a questo messaggio non verranno gestite.</p><p align=center><b>Servizio richiesta informazioni.</b></p><p>Sig: "&nome&" "&cognome&"<br />E-mail: "&email&"<br />Oggetto: "&oggetto&"<br /><br />Testo : "&messaggio&"</p><font style='font-family:Tahoma; font-size:12px; color:#999999'>Questa e-mail, ed i suoi eventuali allegati, contengono informazioni confidenziali e riservate. Se avete ricevuto questa comunicazione per errore non utilizzatene il contenuto e non portatelo a conoscenza di alcuno. Siete inoltre pregati di eliminarla dalla vostra casella e avvisare il mittente. E' da rilevare inoltre che l'attuale infrastruttura tecnologica non puo' garantire l'autenticita' del mittente, ne' tanto-meno l'integrita' dei contenuti. Opinioni, conclusioni ed altre informazioni contenute nel messaggio possono rappresentare punti di vista personali a meno di diversa esplicita indicazione autorizzata.</font></body>"	
				myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
				myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")= cSmtpServer
				myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")= cSmtpPort 
				myMail.Configuration.Fields.Item("http://schemas.microsoft.com/c*do/configuration/sendpassword") = cSMTPPassword
				myMail.Configuration.Fields.Item("http://schemas.microsoft.com/c*do/configuration/sendusername") = cSMTPUser
				myMail.Configuration.Fields.Update

			success = false
			On Error Resume Next
	
				myMail.Send
			Set myMail = Nothing
			
			if Err <> 0 then
				errors(4) = Err.Description
				errored = true
			else
				success = true
			end if
		end if
	end if

	if success then
		thankYouMessage = Replace(thankYouMessage, "%nome%", nome)
		thankYouMessage = Replace(thankYouMessage, "%cognome%", cognome)
		thankYouMessage = Replace(thankYouMessage, "%email%", email)
		thankYouMessage = Replace(thankYouMessage, "%oggetto%", oggetto)
		thankYouMessage = Replace(thankYouMessage, "%messaggio%", messaggio)
		response.write(thankYouMessage)
	else
' in caso di errore formatto la descrizione	
	if errored then
		response.write("<tr>")
		response.write("<td align=left colspan=2>")
		response.write("Attenzione! correggi i seguenti errori:")
		response.write("<ul>")
		for i = lbound(errors) to ubound(errors)
			if errors(i) <> "" then
				response.write("<li>" & errors(i) & "</li>")
			end if
		next
		response.write("</ul>")
		response.write("</td>")
		response.write("</tr>")
	end if
	
%>
          <form method="post" action="<% =Request.ServerVariables("PATH_INFO") %>">
            <tr>
            <td width="36%" height="32"><div align="right">Nome <font color="#FF0000">*</font></div></td>
            <td width="64%"><input type="text" name="nome" value="<% =Request("nome") %>" size="35"></td>
            </tr>
            <tr>
            <td height="32"><div align="right">Cognome</div></td>
            <td><input type="text" name="cognome" value="<% =Request("cognome") %>" size="35"></td>
            </tr>
            <tr>
            <td height="32"><div align="right">Email <font color="#FF0000">*</font></div></td>
            <td><input type="text" name="email" value="<% =Request("email") %>" size="35"></td>
            </tr>
            <tr>
            <td height="32"><div align="right">Oggetto <font color="#FF0000">*</font></div></td>
            <td><input type="text" name="oggetto" value="<% =Request("oggetto") %>" size="35"></td>
            </tr>
            <tr>
            <td colspan="2" align="left">Messaggio:<br />
            <textarea style="width: 535px; height: 171px;" name="messaggio"><% =Request("messaggio") %></textarea></td>
            </tr>
            <tr>
            <td colspan="2">In conformità alle disposizioni previste dalla legge 196/03 sulla tutela dei dati personali La informiamo di quanto segue: I dati personali che Lei vorrà liberamente comunicarci verranno registrati su supporti elettronici, protetti e trattati in via del tutto riservata.<br />I dati non saranno diffusi a terzi. I diritti che potranno essere esercitati in merito all'aggiornamento, alla modifica e alla cancellazione dei dati, sono quelli di cui all'art.7 del dlgs 196/03.</td>
            </tr>
            <tr>
            <td align="right" height="32"><b>Acconsento al trattemento dati </b><font color="#FF0000">*</font></td>
            <td><input id="Privacy" onClick="accetta(this)" type="checkbox" value="Accetto il trattamento dei dati" name="Privacy" /></td>
            </tr>
            <tr>
            <td align="right" height="32">Campi obbligatori&nbsp;<font color="#FF0000">*</font></td>
            <td><input type="submit" disabled="disabled" name="submit" value="   Invia >>  "></td>
            </tr>
          </form>
<% 	end if %>
</table>


Ricordati che in testa al codice devi personalizzarti il nome del server SMTP, il mittente ed il destinatario...
Buona serata
 

stralis66

Nuovo Utente
30 Mar 2014
6
0
0
Ciao paolo ti ringrazio per il codice...do un occhiata poi eventualmente ti chiedo lumi...scusa per il rirardo ma ero fuori per lavoro. Grazie ancora per la risposta.
Buona giornata.
Paolo
 

stralis66

Nuovo Utente
30 Mar 2014
6
0
0
Ok Paolo ho inserito il codice nella posizione desiderata, al momento non posso testarlo perché lavoro in locale, La mia domanda è : posso fare in modo che nella textbox "oggetto" appaia già il numero di riferimento presente nella scheda? Ti invio la pagina ed una screen della pagina web. Grazie per le dritte.
Paolo
Cattura.JPG

il codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<%
ID=request("Id")
Dim OBJdbConnection, RS, SQL, FlagVuoto
FlagVuoto=0
SQL = "SELECT * FROM residenziale where id = " & ID
Set OBJdbConnection = Server.CreateObject("ADODB.Connection")
OBJdbConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("immobili.mdb")
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open SQL, OBJdbConnection
%>
<head>
<title></title>
<link rel="STYLESHEET" type="text/css" href="style.css">
<style type="text/css">
body {
background-image: url(images/fondo2.jpg);
}
body,td,th {
color: #00C;
}
</style>
<script src="js/preferiti.js" type="text/javascript"></script>
<script src="js/stampa.js" type="text/javascript"></script>
<script src="js/hover.js" type="text/javascript"></script>
<script src="js/autosize.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body onLoad="goforit()">


<!-- ////////////////////////////////////////// head ///////////// -->
<table style="width: 730px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tr valign="top">
<td style="width: 200px;"><img src="images/sopra.JPG" width="730" height="90">
<td align="right" valign="bottom">&nbsp;</td>
</tr>
<tr>
<td colspan="3"><hr size="1" color="#C0C0C0" noshade></td>
</tr>
<tr>
<td colspan="2"><div align="center"><!--#include file="menu.inc"--></div></td>
<td></td>
</tr>
</table>


<!-- ///////////////////////////////////// fine head ///////////// -->

<br style="line-height: 20px;">


<!-- ////////////////////////////////////////// main ///////////// -->

<table style="width: 730px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="2" bgcolor="#C3C3C3"><img src="images/blank.gif" width="1" height="6" hspace="0" vspace="0" border="0"></td>
</tr>
<tr>
<td height="100%" style="width: 440px;">

<div style="padding: 1px 10px 0px 40px; border: #A4A4A4 1px solid; border-bottom: 0px; border-right: 0px;">
<table width="85%" border="0" cellspacing="0" cellpadding="0">
<tr valign="middle">
<td class="text2"><span class="titolo">Affitto</span></td>
<td align="right" class="text2">&nbsp;</td>
</tr>
</table></div>

<div id="divCont3" class="text">

<table width="100%" border="0" cellspacing="2" cellpadding="2" style="direction: ltr;">
<tr valign="top">
<td colspan="2">
<%If rs("foto1")<>"" Then%>
<img src="schede/<%=rs("foto1")%>" width="250" height="200" border="1" style="border: 1px solid #F3B79B;">
<%Else%>
<img src="schede/blank_img_big.jpg" width="250" height="200" border="1" style="border: 1px solid #F3B79B;">
<%End If%>
</td>
</tr>
<tr valign="middle">
<td class="text2" style="padding-top: 15px;">
<%If rs("foto2")<>"" Then%>
<a href="javascript:void(0)" onclick="popImmagine('schede/<%=rs("foto2")%>','#FF6825')" class="photo"><img src="images/blank.gif" width="9" height="9" border="0"></a>
<%End If
If rs("foto3")<>"" Then%>
<a href="javascript:void(0)" onclick="popImmagine('schede/<%=rs("foto3")%>','#FF6825')" class="photo"><img src="images/blank.gif" width="9" height="9" border="0"></a>
<%End If
If rs("foto4")<>"" Then%>
<a href="javascript:void(0)" onclick="popImmagine('schede/<%=rs("foto4")%>','#FF6825')" class="photo"><img src="images/blank.gif" width="9" height="9" border="0"></a>
<%End If
If rs("foto5")<>"" Then%>
<a href="javascript:void(0)" onclick="popImmagine('schede/<%=rs("foto5")%>','#FF6825')" class="photo"><img src="images/blank.gif" width="9" height="9" border="0"></a>
<%End If
If rs("foto6")<>"" Then%>
<a href="javascript:void(0)" onclick="popImmagine('schede/<%=rs("foto6")%>','#FF6825')" class="photo"><img src="images/blank.gif" width="9" height="9" border="0"></a>
<%End If%>
&nbsp; <b>altre fotografie</b></td>
<td align="right" class="text2" style="padding-top: 15px;"><b>agenzia di riferimento</b> <a href="#visita"><img src="images/ico_visita.gif" border="0" hspace="3" vspace="0" align="absmiddle" WIDTH="25" HEIGHT="23"></a></td>
</tr>
</table>

<br clear="All">
</div>


</td>
<td style="width: 290px;">
<div style="padding: 7px 10px 7px 20px; border: #A4A4A4 1px solid; border-bottom: 0px;"><img src="images/schedatecnica.gif" border="0" WIDTH="93" HEIGHT="10"></div>
<div id="divCont2" align="justify" class="text">


<!-- ///////////////////////////////////////// scrolling -->

<div class="list4">Zona</div>
<div class="list3"><%=rs("comune")%>, <%=rs("zona")%></div>
<br style="line-height: 10px;">

<div class="list4">Quartiere</div>
<div class="list3"><%=rs("quartiere")%></div>
<br style="line-height: 10px;">

<div class="list4">Tipologia</div>
<div class="list3"><%=rs("tipologia")%></div>
<br style="line-height: 10px;">

<div class="list4">Superfici indicative</div>
<div class="list3">
<%=rs("mq_int")%> Mq. commerciali<br>
<%=rs("mq_est")%> Mq. esterni</div>
<br style="line-height: 10px;">

<div class="list4">Numero camere letto </div>
<div class="list3"><%=rs("camere")%></div>
<br style="line-height: 10px;">

<div class="list4">Disponibile da </div>
<div class="list3"><%=rs("disponibile")%></div>
<br style="line-height: 10px;">

<div class="list4">Canone mensile indicativo </div>
<div class="list3">€. <%=rs("canone")%></div>
<br style="line-height: 10px;">

<table border="0" cellspacing="0" cellpadding="2">
<%If rs("vuoto")="1" then%>
<tr><td>vuoto </td></tr>
<%End If%>
<%If rs("arredato")="1" then%>
<tr><td>arredato </td></tr>
<%End If%>
<%If rs("semiarredato")="1" then%>
<tr><td>semiarredato </td></tr>
<%End If%>
<%If rs("cucina")="1" then%>
<tr><td>cucina arredata </td></tr>
<%End If%>
<%If rs("ascensore")="1" then%>
<tr><td>ascensore </td></tr>
<%End If%>
<%If rs("portineria")="1" then%>
<tr><td>portineria </td></tr>
<%End If%>
<%If rs("auto")="1" then%>
<tr><td>posti auto </td></tr>
<%End If%>
<%If rs("terrazzo")="1" then%>
<tr><td>terrazzo </td></tr>
<%End If%>
<%If rs("giardino_cond")="1" then%>
<tr><td>giardino condominiale </td></tr>
<%End If%>
<%If rs("giardino")="1" then%>
<tr><td>giardino privato </td></tr>
<%End If%>
<%If rs("riscaldamento")="1" then%>
<tr><td>riscaldamento autonomo </td></tr>
<%End If%>
<%If rs("allarme")="1" then%>
<tr><td>impianto allarme </td></tr>
<%End If%>
<%If rs("tvsat")="1" then%>
<tr><td>impianto TV Sat </td></tr>
<%End If%>
<%If rs("aria")="1" then%>
<tr><td>aria condizionata </td></tr>
<%End If%>
<%If rs("idromassaggio")="1" then%>
<tr><td>idromassaggio </td></tr>
<%End If%>
<%If rs("tapparelle")="1" then%>
<tr><td>tapparelle elettriche </td></tr>
<%End If%>
<%If rs("porta")="1" then%>
<tr><td>porta blindata </td></tr>
<%End If%>
<%If rs("lavanderia")="1" then%>
<tr><td>lavanderia </td></tr>
<%End If%>
<%If rs("illuminazione")="1" then%>
<tr><td>impianto di illuminazione </td></tr>
<%End If%>
<%If rs("trattativa_ris")="1" then%>
<tr><td>trattative riservate </td></tr>
<%End If%>
<%If rs("intrattativa")="1" then%>
<tr><td>in trattativa</td></tr>
<%End If%>
</table><br>
<br style="line-height: 5px;">

<div style="padding: 10px 10px 10px 10px; border: #FF6825 1px solid;">
<div class="list4">Numero di riferimento</div>
<div class="list3"><%=rs("riferimento")%></div>
<br style="line-height: 10px;">

<a name="visita"><div class="list4">Agente responsabile</div></a>
<div class="list3"><%=rs("agente")%></div>
<br style="line-height: 10px;">

<div class="list4">Contatto telefonico</div>
<div class="list3"><%=rs("contatto")%></div>
<script language="javascript">
<!--
function accetta(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){
var tempobj=checkobj.form.elements
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}
function disabilita(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert(" Compilare i campi obbligatori /n All fields required")
return false
}
}
}
-->
</script>
<table align="center" border="0" cellpadding="3" cellspacing="1" width="247" style="font-family:Verdana; font-size:10px">
<tr>
<td align="left" style="color:#FFFFFF; background-color:#333333" colspan="2">&nbsp;Contatti</td>
</tr><%

' ------------------
' Configurazione SMTP
Dim cSmtpServer, cSmtpPort, cSMTPUser, cSMTPPassword
Dim nomedominio, indirizzoIp, modulo, browserSistemaOperativo
Dim oggetto_email, mittente, destinatario
' ------------------
' SETUP
' INFORMAZIONI DA PERSONALIZZARE
cSmtpServer = "smtp.miodominio.it"
cSmtpPort = "25"
cSMTPUser = ""
cSMTPPassword = ""
' ------------------
oggetto_email = "Richiesta informazioni"
mittente = "[email protected]"
destinatario = "[email protected]"
' ------------------
' VARIABILI NON UTILIZZATE IN QUESTO SCRIPT
nomeDominio = Request.ServerVariables("HTTP_HOST")
indirizzoIp = Request.ServerVariables("REMOTE_ADDR")
modulo = Request.ServerVariables("HTTP_REFERER")
browserSistemaOperativo = Request.ServerVariables("HTTP_USER_AGENT")
' ------------------

showRating = true
thankYouMessage = "<tr><td align=left colspan=2>Grazie %nome% %cognome% per aver utilizzato il servizio!<br />La seguente richiesta stata inoltrata allo Staff preposto al nostro sistema web:<br /><br />Nome - %nome% <br />Cognome - %cognome%<br />Indirizzo email - %email% <br />Oggetto - %oggetto% <br />Messaggio - %messaggio%</td></tr>"
errorMessage = "Attenzione! correggi i seguenti errori:"

function clearUnSafeTags(s)
dim re
Set re = New RegExp
're.Pattern = "(<( )*\/{0,1}( )*(?!b|i|u|p|a|ul|li|ol)[^>]*>)"
re.Pattern = "<(?!b>|\/b>|br>|li>|\/li>|i>|\/i>|u>|\/u>)[^>]*>"
re.Global = true
re.IgnoreCase = true
clearUnSafeTags = re.replace(s, "")
end function

function IsEmail(strEmail)
Dim strTemp
strEmail = CStr(strEmail)
IsEmail = false
if not InStr(strEmail, "@") > 0 then
exit function
end if
if not InStr(strEmail, ".") > 0 then
exit function
end if
if not Len(Left(strEmail, Instr(strEmail, "@") - 1)) => 3 then
exit function
end if
strTemp = Mid(strEmail, InStr(strEmail, "@") + 1, Len(strEmail))
if not Len(Left(strTemp, InStr(strTemp, ".") - 1)) => 3 then
exit function
end if
if not Len(Right(strTemp, Len(strTemp) - Instr(strTemp, "."))) => 2 then
exit function
end if
IsEmail = true
end function

If Request("submit") <> "" Then

dim errors(4)
errored = false

if request("nome") = "" then
errors(0) = "Prego inserisci il tuo nome"
errored = true
end if
if request("email") = "" then
errors(1) = "Prego inserisci il tuo indirizzo email"
errored = true
end if
if request("email") <> "" and not IsEmail(request("email")) then
errors(1) = "Prego <b>correggi</b> il tuo indirizzo email"
errored = true
end if
if request("oggetto") = "" then
errors(2) = "Prego inserisci l'oggetto della richiesta"
errored = true
end if
if request("messaggio") = "" then
errors(3) = "Prego inserisci il messaggio"
errored = true
end if

if not errored then


' dichiaro le variabili dei form
nome = clearUnSafeTags(request("nome"))
cognome = clearUnSafeTags(request("cognome"))
email = clearUnSafeTags(request("email"))
oggetto = clearUnSafeTags(request("oggetto"))
messaggio = Replace(Replace(Request.Form("messaggio"), chr(13), "<BR>", 1) , "'", "′")

' Windows XP / 2003
Set myMail = CreateObject("CDO.Message")
myMail.Subject = oggetto_email ' oggetto
myMail.From = mittente ' mittente
myMail.To = destinatario ' destinatario
' myMail.bCC = "[email protected]" 'destinatario nascosto
myMail.HTMLBody = "<body><p>Questa mail &egrave; stata generata da un computer, eventuali risposte a questo messaggio non verranno gestite.</p><p align=center><b>Servizio richiesta informazioni.</b></p><p>Sig: "&nome&" "&cognome&"<br />E-mail: "&email&"<br />Oggetto: "&oggetto&"<br /><br />Testo : "&messaggio&"</p><font style='font-family:Tahoma; font-size:12px; color:#999999'>Questa e-mail, ed i suoi eventuali allegati, contengono informazioni confidenziali e riservate. Se avete ricevuto questa comunicazione per errore non utilizzatene il contenuto e non portatelo a conoscenza di alcuno. Siete inoltre pregati di eliminarla dalla vostra casella e avvisare il mittente. E' da rilevare inoltre che l'attuale infrastruttura tecnologica non puo' garantire l'autenticita' del mittente, ne' tanto-meno l'integrita' dei contenuti. Opinioni, conclusioni ed altre informazioni contenute nel messaggio possono rappresentare punti di vista personali a meno di diversa esplicita indicazione autorizzata.</font></body>"
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")= cSmtpServer
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")= cSmtpPort
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/c*do/configuration/sendpassword") = cSMTPPassword
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/c*do/configuration/sendusername") = cSMTPUser
myMail.Configuration.Fields.Update

success = false
On Error Resume Next

myMail.Send
Set myMail = Nothing

if Err <> 0 then
errors(4) = Err.Description
errored = true
else
success = true
end if
end if
end if

if success then
thankYouMessage = Replace(thankYouMessage, "%nome%", nome)
thankYouMessage = Replace(thankYouMessage, "%cognome%", cognome)
thankYouMessage = Replace(thankYouMessage, "%email%", email)
thankYouMessage = Replace(thankYouMessage, "%oggetto%", oggetto)
thankYouMessage = Replace(thankYouMessage, "%messaggio%", messaggio)
response.write(thankYouMessage)
else
' in caso di errore formatto la descrizione
if errored then
response.write("<tr>")
response.write("<td align=left colspan=2>")
response.write("Attenzione! correggi i seguenti errori:")
response.write("<ul>")
for i = lbound(errors) to ubound(errors)
if errors(i) <> "" then
response.write("<li>" & errors(i) & "</li>")
end if
next
response.write("</ul>")
response.write("</td>")
response.write("</tr>")
end if

%>
<form method="post" action="<% =Request.ServerVariables("PATH_INFO") %>">
<tr>
<td width="29%" height="32" align="left"><div align="right">Nome <font color="#FF0000">*</font></div></td>
<td width="61%" align="left">
<input type="text" name="nome" value="<% =Request("nome") %>" size="24"></td>
</tr>
<tr>
<td width="29%" height="32" align="left"><div align="right">Cognome </div></td>
<td align="left">
<input type="text" name="cognome" value="<% =Request("cognome") %>" size="24"></td>
</tr>
<tr>
<td height="32" align="left"><div align="right">Email <font color="#FF0000">*</font></div></td>
<td align="left">
<input type="text" name="email" value="<% =Request("email") %>" size="24"></td>
</tr>
<tr>
<td height="32" align="left"><div align="right">Oggetto <font color="#FF0000">*</font></div></td>
<td align="left">
<input type="text" name="oggetto" value="<% =Request("oggetto") %>" size="24"></td>
</tr>
<tr>
<td colspan="2" align="left">Messaggio:<br />
<textarea style="width: 230; height: 74" name="messaggio"><% =Request("messaggio") %></textarea><p>Campi obbligatori&nbsp;<font color="#FF0000">*</font></td>
</tr>
<tr>
<td colspan="2">
<p align="justify">Acconsento al trattamento dati <font color="#FF0000">*&nbsp; </font>
<input id="Privacy0" onClick="accetta(this)" type="checkbox" value="Accetto il trattamento dei dati" name="Privacy0" style="float: left" /></td>
</tr>
<tr>
<td align="right" height="30">
<p align="left">&nbsp;</td>
<td>
<p align="center">
<input type="submit" disabled="disabled" name="submit" value=" Invia >> " style="float: left"></td>
</tr>
</form>
<% end if %>
</table>
<br style="line-height: 10px;">
</div>


<!-- ///////////////////////////////////// end scrolling -->

</div>
</td>
</tr>
<tr>
<td colspan="2">
<div align="justify" class="text" style="padding: 5px 10px 5px 10px; border: #A4A4A4 1px solid; border-top: 0px;">

<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr valign="middle">
<td><a href="javascript:preferiti()" class="0"><img src="images/ico_salva.gif" hspace="3" vspace="0" border="0" align="absmiddle" WIDTH="18" HEIGHT="16"> aggiungi preferiti</a> &nbsp; <a href="javascript:history.go(-1)" class="0"><img src="images/ico_back.gif" hspace="3" vspace="0" border="0" align="absmiddle" WIDTH="18" HEIGHT="16"> indietro</a></td>
<td align="right"><a href="javascript:stampa()" class="0">stampa questa pagina <img src="images/ico_stampa.gif" hspace="3" vspace="0" border="0" align="absmiddle" WIDTH="18" HEIGHT="16"></a></td>
</tr>
</table>
</div>
</td>
</tr>
</table>


<!-- ///////////////////////////////////// fine main ///////////// -->



<table style="width: 730px;" border="0" cellspacing="0" cellpadding="0" align="center">
<tr valign="top">
<td class="ora"><div style="width: 430px; margin-top:100px;">
<font color="#0000FF"><img src="images/mark_p.gif" hspace="10" vspace="2" border="0" align="left" WIDTH="30" HEIGHT="30">Le informazioni contenute in questo sito sono da considerarsi puramente indicative e non hanno nessun titolo ne presupposto contrattuale.</font></div></td>


<td align="right" style="padding-top: 15px;">

<!-- ////////////////////////////////////////////// legenda ///// --><!-- ///////////////////////////////////////// fine legenda ///// -->

</td>
</tr>
</table>



</body>
</html>
 
Ultima modifica:

stralis66

Nuovo Utente
30 Mar 2014
6
0
0
Grazie Paolo
avevo risolto in quella maniera e mi hai confermato che è esatto. Ancora grazie. se avessi qualche altro problema ti chiedo.
Ne approfitto per augurarti una felice Pasqua-
Ciao.

paolo
 
Discussioni simili
Autore Titolo Forum Risposte Data
A [PHP] RISOLTO Invio Mail con Tabella PHP 2
S Problema in PHP per invio file XML - RISOLTO- PHP 8
D [Risolto] Invio mail a blocchi Classic ASP 31
I [Risolto] Problemi invio e-mail con CDOSYS con domini @live.it Classic ASP 4
S [RISOLTO]invio form con select onchange Javascript 2
L (risolto) MySQL 0
B getElementById su piu id(Risolto) Javascript 7
L Esercitarsi con Js [RISOLTO] Javascript 4
C [RISOLTO]Inserimento variabile php in input html PHP 20
L risolto visualizzazione e ordinamento dati PHP 1
moustache [RISOLTO] SQL PHP IIS PHP 8
Sergio Unia Ricezione email con destinatari multipli [Risolto] PHP 2
L update tabelle in php mysql [risolto] PHP 6
M Semplice visualizzatore di immagini [risolto con plugin wp] PHP 7
L [RISOLTO] Stampa a video risultato count in html PHP 13
L [RISOLTO] Eliminare una discussione creata PHP 3
tomorc [HTML] Problema con scroll bar (risolto) HTML e CSS 0
A [PHP] Problema query insert [RISOLTO] PHP 14
B [PHP] recuperare IP dei server in load balancing [RISOLTO] PHP 3
K [RISOLTO] Problema Griglia Php+Mysql PHP 13
S [RISOLTO] aggiorna tabella da select option asp classic Classic ASP 7
elpirata [RISOLTO][Javascript] Datapicker e autocompletamento campo input Javascript 2
elpirata [RISOLTO][Mysql] Problema insert valori apostrofati MySQL 1
elpirata [RISOLTO][Mysql] Contare le occorrenze in un campo tipo varchar MySQL 2
G [MS Access] Gestione biglietti [RISOLTO] MS Access 2
G [MS Access] Casella combinata & Query [RISOLTO] MS Access 4
G [MS Access] Query mese corrente con conteggio [RISOLTO] MS Access 2
M [RISOLTO]Windows media player non mi funziona più su win 10 pro 64 bit Windows e Software 2
C [RISOLTO][PHP] Errore di sintassi PHP 8
IT9-Gpp [RISOLTO] Leggere variabile restituita da success Ajax 3
Kolop [RISOLTO][PHP] Problema Pagination PHP 2
C [RISOLTO][PHP] Funzione ONclick PHP 14
C [RISOLTO][PHP] Conteggio righe di una tabella PHP 4
N [PHP] Utilizzo variabili di sessione [Risolto] PHP 13
Tommy03 [RISOLTO][PHP] Webserver o devserver? PHP 2
Sergio Unia Recupero dati da una vecchia versione MySql [Risolto] MySQL 4
spider81man [PHP] Problemi cancellazione dato su DB [RISOLTO] PHP 1
A [RISOLTO]Inserimento Immagini da pc a MySql PHP 15
felino Risolto - [Wordpress][WooCommerce] PayPal Checkout e campi di fatturazione WordPress 2
elpirata [PHP][RISOLTO] Sommare gli importi estratti da un ciclo while PHP 3
elpirata [PHP][RISOLTO] Effettuare la somma dei tempi di lavorazione PHP 3
elpirata [PHP] [RISOLTO]Sovrascrivere testo in una tabella PHP 2
A [RISOLTO]Recuperare dati inviati con json tramite php PHP 4
C [RISOLTO][PHP] Passaggio variabili senza refresh di pagina PHP 7
elpirata [PHP][RISOLTO] Errore di tipo Notice: Undefined index - Come risolvere quando si hanno tante var PHP 10
A [Javascript] [RISOLTO] Doppio "submit", in uno stesso "Form" , che puntino ad "action" diversi Javascript 1
marino51 [Risolto]videochat di messenger ha smesso di funzionare sul telefonino Smartphone e tablet 1
A [Javascript] [HTML] RISOLTO...Allungare un box all'apertura della pagina No Mouse over Javascript 9
ken_korn [Javascript][Risolto] browser.tab.Tabs.favIconUrl non funziona Javascript 5
A [RISOLTO] HighChart e PHP PHP 4

Discussioni simili