<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Problema Form Email]]></title><description><![CDATA[<p dir="auto">Ciao a tutti!<br />
Sono ormai arrivato alla frutta e non riesco a trovare l'errore nell'invio della email dal form del sito.<br />
Di seguito riporto il codice!</p>
<p dir="auto"><strong>HTML</strong></p>
<pre><code>&lt;form action="send.php" id="contact-form" method="post" name="testform"&gt;
							&lt;fieldset&gt;
								&lt;label&gt;Nome &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
								&lt;input type="text" name="f_nome" value="" class="text requiredField"/&gt;
							&lt;/fieldset&gt;
							&lt;fieldset&gt;
								&lt;label&gt;Email &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
								&lt;input type="text" name="f_email" value="" class="text requiredField email"/&gt;
							&lt;/fieldset&gt;
							&lt;fieldset&gt;
								&lt;label&gt;Oggetto &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
								&lt;input type="text" name="f_oggetto" value="" class="text requiredField subject"/&gt;
							&lt;/fieldset&gt;
							&lt;fieldset&gt;
								&lt;label&gt;Messaggio &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
								&lt;textarea name="f_messaggio" rows="20" cols="30" class="text requiredField"&gt;&lt;/textarea&gt;
							&lt;/fieldset&gt;
							&lt;fieldset&gt;
								&lt;input name="Submit" value="Invia messaggio" class="button orange" type="submit"/&gt;
                                &lt;input type="hidden" name="sme2_form" value="1" /&gt;
							&lt;/fieldset&gt;
						&lt;/form&gt;
</code></pre>
<p dir="auto"><strong>PHP</strong></p>
<pre><code>&lt;?php
// change the variables bellow 
// Your email here
$email = "info@it";

$sme2_form_c = "Richiesta Informazioni Dal Sito";

$homepageurl = "Conferma Invio Email a Serizio Ponteggi Edilizia srl";


if ($_POST['sme2_form']) {
	$date = date("d/m/Y H:i:s");
	$header = "From: $_POST[f_email]\n";
	$header .= "CC: $email_cc\n";
	// costruiamo le intestazioni specifiche per il formato HTML
	$header .= "MIME-Version: 1.0\n";
	$header .= "Content-Type: text/html; charset=UTF-8\n";
	$header .= "Content-Transfer-Encoding: 7bit\n\n";
	//MESSAGGIO CHE ARRIVA ALLA NOSTRA CASELLA EMAIL
	$msg = "&lt;html&gt;&lt;head&gt;&lt;style type=\"text/css\"&gt;
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
}
body {
	background-repeat: repeat-x;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}

h1 {
	font-size: 18px;
	color: #333;
	border-top-style: none;
	border-right-style: none;
	border-bottom-style: none;
	border-left-style: none;
	margin-left: 10px;
}
.color {
	color: #cc3333;
}
body p {
	font-weight: bold;
	color: #333;
	font-size: 14px;
	padding-top: 0px;
	padding-right: 0px;
	padding-bottom: 2px;
	padding-left: 0px;
	border-bottom-width: 1px;
	border-bottom-style: dashed;
	border-bottom-color: #666;
	width: 30%;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 10px;
	margin-left: 10px;
}
.para {
	border-top-style: none;
	border-right-style: none;
	border-bottom-style: none;
	border-left-style: none;
	font-size: 12px;
	padding: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	margin-left: 10px;
}
.data {
	font-size: 10px;
	color: #cc3333;
	margin-top: 20px;
	border-top-style: none;
	border-right-style: none;
	border-bottom-style: none;
	border-left-style: none;
}
a {
	color: #333;
	text-decoration: none;
}
&lt;/style&gt;&lt;/head&gt;"; 
	$msg .="&lt;body&gt;";
	$msg .="&lt;h1&gt;Richiesta informazioni di contatto dal sito web&lt;/h1&gt;";							
	$msg .="&lt;p&gt;" . "Nome: " . "&lt;span class=\"color\"&gt; " . $_POST[f_nome] . " &lt;/span&gt;&lt;/p&gt;";
	$msg .="&lt;p&gt;" . "Email: " . "&lt;span class=\"color\"&gt; " . $_POST[f_email] . " &lt;/span&gt;&lt;/p&gt;";
	$msg .="&lt;p&gt;" . "Oggetto: " . "&lt;span class=\"color\"&gt; " . $_POST[f_oggetto] . " &lt;/span&gt;&lt;/p&gt;";
	$msg .="&lt;p&gt;" . "Messaggio: " . "&lt;span class=\"color\"&gt; " . $_POST[f_messaggio] . " &lt;/span&gt;&lt;/p&gt;"; 
	$msg .="&lt;p class=\"data\"&gt;Invio del messaggio in data: " . $date  . "&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;";
	 
	 
	//MESSAGIO DI INVIO PER IL DESTINATARIO CHE HA RICHIESTO INFORMAZIONI
	$msg_mit = "&lt;html&gt;&lt;head&gt;&lt;style type=\"text/css\"&gt;
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
}
body {
	background-repeat: repeat-x;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}

h1 {
	font-size: 18px;
	color: #333;
	border-top-style: none;
	border-right-style: none;
	border-bottom-style: none;
	border-left-style: none;
	margin-left: 10px;
}
.color {
	color: #cc3333;
}
body p {
	font-weight: bold;
	color: #333;
	font-size: 14px;
	padding-top: 0px;
	padding-right: 0px;
	padding-bottom: 2px;
	padding-left: 0px;
	border-bottom-width: 1px;
	border-bottom-style: dashed;
	border-bottom-color: #666;
	width: 30%;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 10px;
	margin-left: 10px;
}
.para {
	border-top-style: none;
	border-right-style: none;
	border-bottom-style: none;
	border-left-style: none;
	font-size: 12px;
	padding: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	margin-left: 10px;
}
.data {
	font-size: 10px;
	color: #cc3333;
	margin-top: 20px;
	border-top-style: none;
	border-right-style: none;
	border-bottom-style: none;
	border-left-style: none;
}
a {
	color: #333;
	text-decoration: none;
}
&lt;/style&gt;&lt;/head&gt;";
	$msg_mit .="&lt;body&gt;";
	$msg_mit .="&lt;h1&gt;La sua richiesta è stata inoltrata&lt;/h1&gt;";				///Reparto Da personalizzare
	$msg_mit .="&lt;p&gt;Al più presto sarà contattato per ulteriori informazioni.&lt;/p&gt;";
	$msg_mit .="&lt;p class=\"para\"&gt;-Grazie per averci contattato.&lt;/p&gt;";
	$msg_mit .="&lt;p class=\"para\"&gt;&lt;a href=\"http://www\"&gt; srl&lt;/a&gt;&lt;/p&gt;" . "&lt;/body&gt;&lt;/html&gt;";
	
	///INVIO EMAIL
	@mail("$email", "$sme2_form_c", "$msg" ,"$header");
	@mail("$_POST[f_email]","$homepageurl ", "$msg_mit" ,"$header"); 


echo("&lt;div align=\"center\"&gt;&lt;h1&gt;Invio .. .. ..!!&lt;/h1&gt;" . "&lt;/div&gt;");
//echo("&lt;p align=\"center\"&gt;Verrai reindirizzato tra meno d i 5 secondi&lt;/p&gt;");
}
else{}
?&gt;
</code></pre>
<p dir="auto">Questo invece il JS che verifica</p>
<pre><code>});
jQuery.noConflict()(function($){
$(document).ready(function() {
$('form#contact-form').submit(function() {
$('form#contact-form .error').remove();
var hasError = false;
$('.requiredField').each(function() {
if(jQuery.trim($(this).val()) == '') {
 var labelText = $(this).prev('label').text();
 $(this).parent().append('&lt;div class="error"&gt;Hai dimenticato di inserire '+labelText+'&lt;/div&gt;');
 $(this).addClass('inputError');
 hasError = true;
 } else if($(this).hasClass('email')) {
 var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
 if(!emailReg.test(jQuery.trim($(this).val()))) {
 var labelText = $(this).prev('label').text();
 $(this).parent().append('&lt;div class="error"&gt;Qualche errore in questo campo '+labelText+'&lt;/div&gt;');
 $(this).addClass('inputError');
 hasError = true;
 }
 }
});
if(!hasError) {
$('form#contact-form input.submit').fadeOut('normal', function() {
$(this).parent().append('');
});
var formInput = $(this).serialize();
$.post($(this).attr('action'),formInput, function(data){
$('form#contact-form').slideUp("normal", function() {
$(this).before('&lt;div class="simple-success"&gt;Email spedita! Al più presto sarai ricontattato.&lt;/div&gt;');
});
});
}

return false;
</code></pre>
<p dir="auto">La compilazione funziona e viene verificata ma l'email non viene inviata!</p>
]]></description><link>https://dev.connect.gt/topic/160535/problema-form-email</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 10:05:38 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/160535.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 04 Nov 2011 10:28:42 GMT</pubDate><ttl>60</ttl></channel></rss>