Spero che sia quello che volevi...
Graficamente è da sistemare!
Codice PHP:
<?php
$youraddress = "pippo@pippo.com"; // Your e-mail address - duh
$subject_prefix = "[CONTACT] "; // What you want the subjects to be prefixed with - can be left blank
$timeoffset = "0"; // How many hours you are off your server
$message = stripslashes(strip_tags($_POST['message']));
function emailform() {
global $message
// You can make this form look like whatever you want. All it needs
// to have are fields for "name", "email", "subject" and "message".
// The following is just a very simple one you can use or modify.
?><form name="emailform" method="post" action="<?php echo $PHP_SELF ?>">
<table width="380" border="0" cellspacing="0"><tr><td width="608">
<fieldset>
<font size="2" face="verdana">
<legend>[b]Messaggio[/b]</legend>
<textarea name="message" id="message" cols="57" rows="7" tabindex="4"><?php echo $message; ?></textarea>
</font>
</fieldset>
</td>
</tr><tr height=10><td><font size="2" face="verdana"> </font></td>
</tr><tr><td>
<fieldset>
<font size="2" face="verdana">
<legend></legend>
<input type="submit" name="submit" value=" E-Mail Me! ">
</font>
</fieldset>
</td>
</tr>
</table>
</form>
<?php }
if ($_POST['submit'] || isset($_POST['submit'])) {
if ($message == "" || !isset($message)) {
echo "
[b]Il campo messaggio è obbligatorio![/b]</p>";
emailform();
} else {
$time = time()+$timeoffset*3600;
$url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$message = "
<html>
<head>
<title>E-Mail Sent From ".$url."</title>
</head>
<body>
The following was sent from <a href=\"".$url."\">".$url."</a>:
[b]Subject:[/b] ".$subject_prefix."
[b]User's IP Address:[/b] ".$_SERVER['REMOTE_ADDR']."
[b]Sent At:[/b] ".date("l, F jS, Y h:i:s A",$time)."
[b]Message:[/b]
".nl2br($message)."
</body>
</html>";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
mail($youraddress,$subject_prefix,$message,$headers) or die("Sorry, there was an error when sending the e-mail.
Please contact <a href=\"mailto:".$youraddress."\">".$youraddress."</a>");
echo "E-mail successfully sent!";
}
} else {
echo "
[b]Campo messaggio obbligatorio[/b]</p>";
emailform();
}
?>