<?php
ini_set("SMTP","mail.domain.com"); // i dont know if you need these added in or not
ini_set("sendmail_from","user@domain.com"); //but to send from local host you need to set them
$name = $_POST['name']; //name returned from the form
$email = $_POST['email']; //email returned from the form
$comments = $_POST['comments']; //comments returned from the form
$ip = $_SERVER['REMOTE_ADDR']; //ip of the form user
$to = "email@domain.com"; //set to your email address
$message = "Name: $name \n Email: $email \n Comments: $comments \n ";
if(mail($to,"Site Contact",$message,"From: $email\n","IP: $ip")) {
{
print "Success";
}
} else {
print "Failed";
}
//you'll find it alot easier if you label things even though you know what they do
?>
these are the errors i get from your script
Notice: Undefined variable: REMOTE_ADDR in C:\Program Files\Abyss Web Server\htdocs\phoenix2\mailto.php on line 14
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\Abyss Web Server\htdocs\phoenix2\mailto.php on line 15
Error.
i have fixed the REMOTE_ADDRESS by defining it first with $ip
and i added the 2 lines of code to define the config for your smtp server and the the email address to be sent from if its needed
Regards
Mitch