Per favore inserisci il tuo nome.'; exit(); } else if(trim($email) == '') { echo '
Per favore inserisci una e-mail valida.
'; exit(); } else if(trim($phone) == '') { echo '
Per favore inserisci un numero di telefono valido.
'; exit(); } else if(!is_numeric($phone)) { echo '
Il campo telefono deve contenere solo numeri.
'; exit(); } else if(!isEmail($email)) { echo '
Hai inserito una e-mail non valida.
'; exit(); } if(trim($comments) == '') { echo '
Scrivere un messaggio.
'; exit(); } if(get_magic_quotes_gpc()) { $comments = stripslashes($comments); } // Configuration option. // Enter the email address that you want to emails to be sent to. // Example $address = "yourname@yourdomain.com"; $address = "mailto:info@aefs.eu"; // Configuration option. // i.e. The standard subject will appear as, "You've been contacted by John Doe." // Example, $e_subject = '$name . ' has contacted you via Your Website.'; $e_subject = 'Sei stato contattato da ' . $name . '.'; // Configuration option. // You can change this if you feel that you need to. // Developers, you may wish to add more fields to the form, in which case you must be sure to add them here. $e_body = "Sei stato contattato da $name tramite il tuo sito, ecco il messaggio:" . PHP_EOL . PHP_EOL; $e_content = "\"$comments\"" . PHP_EOL . PHP_EOL; $e_reply = "Puoi contattare $name tramite e-mail, $email o al numero $phone"; $msg = wordwrap( $e_body . $e_content . $e_reply, 70 ); $headers = "From: $email" . PHP_EOL; $headers .= "Reply-To: $email" . PHP_EOL; $headers .= "MIME-Version: 1.0" . PHP_EOL; $headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL; $headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL; if(mail($address, $e_subject, $msg, $headers)) { // Email has sent successfully, echo a success page. echo "
"; echo "
"; echo "

Email spedita correttamente.

"; echo "

Grazie $name, verrai ricontattato il prima possibile.

"; echo "
"; echo "
"; } else { echo 'ERROR!'; }