GRAZIE "; print_r($_POST); print ""; */ require('class.phpmailer.php'); function getUserIP() { $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; if(filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif(filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } return $ip; } $user_ip = getUserIP(); if ($_POST['email']!="") { $line=$_POST; $handle = fopen("assistenza.csv", "a"); fputcsv($handle, $line, ';'); # $line is an array of string values here fclose($handle); $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch $mail->CharSet = "UTF-8"; $mail->IsSendmail(); // telling the class to use SendMail transport $html="Assistenza Lasio

Data e Ora: ".date("d/m/Y H:i:s")."
E-Mail: ".$_POST['email']."
IP: ".$user_ip."
"; foreach ($_POST as $key => $val) { $html.="
".$key." ".$val.""; } try { $mail->AddAddress('davide.batzella@gmail.com'); $mail->AddAddress('piccipaolo1986@gmail.com'); $mail->SetFrom('info@lasiomacchineagricole.it', 'Assistenza Lasio'); $mail->AddReplyTo('info@lasiomacchineagricole.it', 'Assistenza Lasio'); $mail->Subject = "Assistenza Lasio"; $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically $mail->MsgHTML($html); $mail->Send(); //echo "Message Sent OK to ".$mail_destinatario."

\n"; } catch (phpmailerException $e) { $e->errorMessage(); //Pretty error messages from PHPMailer } catch (Exception $e) { $e->getMessage(); //Boring error messages from anything else! } } ?>