First.. make sure your local server has SMTP or sendmail support and that mail is enabled.
Set headers.
SEE BELOW AND YOU CAN COPY AND PASTE 😉
(You can use this code, just have a form with realname, email, message and a hidden form field 'inquiry'.. then post it...
if(isset($POST['inquiry'])) {
//do the mail and echo out the thank you or error
$mailbody = "";
$oktosend = 1;
if(strlen($POST['realname']) < 2){
echo "<p style=\"color:red;\">Sorry, you must supply your name.<br></p>";
$oktosend = 0;
}else{$mailbody .="Name : ".$POST['realname']."\n";}
if(strlen($POST['email']) < 5){
echo "<p style=\"color:red;\">Sorry, the server encountered a problem with your email address.<br>Please try again with another email address.</p>";
$oktosend = 0;
}else{$email=trim($POST['email']);$mailbody.="Reply EMail: ".$email."\n";}
if(strlen($POST['message']) < 5){
echo "<p style=\"color:red;\">Sorry, your message was empty.<br></p>";
$oktosend = 0;
}else{$mailbody.="Message : \n".$POST['message']."\n";}
$mailbody.="---------------\n";
$mailbody.="USER INFO\n";
$mailbody.="---------------\n";
$mailbody.="User Agent :".$SERVER['HTTP_USER_AGENT']."\n";
$mailbody.="IP adress is :".$SERVER['REMOTE_ADDR']."\n";
$mailbody.="Remote host is : ".$SERVER['REMOTE_HOST']."\n";
$mailbody.="-------------\n";
$date=date("m/d/Y H:i:s");
$mailbody.="SERVER INFO\n";
$mailbody.="Send date/time : ".$date."\n";
$mailbody.="Came From web : ".$SERVER['HTTP_HOST']."\n";
if($oktosend === 1){
@mail("aqua@aquapure.ph","WebSite Inquiry",$mailbody,"From: ".$POST['email']."\n");
echo "<p><span style='color:green;font-size:18px;font-weight:bold;font-family:Courier,Lucinda,Sans-Serif;'>Your inquiry has been sent.<br>You shall receive a reply shortly.<br><i>Thank You!</i></span></p>";
unset($POST['inquiry']);
}else{
echo "<p style=\"color:red;\">Your message was not sent. Please <a href='sharea.php?xpath=contact'>try again</a></p>"; unset($POST['inquiry']);
}