Skip to content

Instantly share code, notes, and snippets.

@dbellettini
Created November 3, 2010 11:08
Show Gist options
  • Save dbellettini/660975 to your computer and use it in GitHub Desktop.
Save dbellettini/660975 to your computer and use it in GitHub Desktop.
Quanto ero ingenuo da giovine :D
<?php
/*
QUESTO PROGRAMMA SUPPONE CHE IL CONTROLLO DEI DATI SIA EFFETTUATO
TRAMITE JAVASCRIPT LATO CLIENT
*/
//attenzione, questo parametro dipende dal nome del campo e-mail
//inserito nell'html
$emailfield="EMail";
$maildest="xxx@xxx.xxx"; //mail di destinazione
$mailfrom=$_POST[$emailfield];
$mailsubject="Richiesta informazioni"; //oggetto della mail inviata
//inizio della mail inviata
$mailtext="";
$mailtext.="Ricevuta richiesta di informazioni:\n\n";
$mailtext.="Sono stati inseriti i seguenti dati: \n";
//aggiungo i parametri inseriti, per come è costruito lo script
//possono essere aggiunti tutti i campi che si vuole, verranno stampati
foreach($_POST as $chiave => $valore) {
$mailtext.="$chiave = $valore\n";
}
?>
<html>
<head><title>Invio e-mail in corso...</title></head>
<body><h1>Invio e-mail</h1>
<?
mail($maildest,$mailsubject,$mailtext,"From: $mailfrom") or die ("<p align=\"center\">Errore invio mail!</p></body></html>");
echo "<p align=\"center\">Mail inviata</p>";
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment