Hello,
How to make the contact us works?
contactus.php
<?php
// require_once('recaptchalib.php');
$name = strip_tags(@$_POST['name']);
$email = str_replace(" ", "", strip_tags(@$_POST['email']));
$subject = str_replace(" ", "", strip_tags(@$_POST['subject']));
$message = strip_tags(@$_POST['message']);
if (@$_POST['submit']) {
if ($name&&$email&&$subject&&$message) {
// $privatekey = "6LfjvdcSAAAAAHNcKjYO5DhTNefxYZHYcfhtrvGC";
// $resp = recaptcha_check_answer($privatekey,
// $_SERVER["REMOTE_ADDR"],
// $_POST["recaptcha_challenge_field"],
// $_POST["recaptcha_response_field"]);
// if (!$resp->is_valid) {
//What happens when the CAPTCHA was entered incorrectly
// echo "The reCAPTCHA wasn't entered correctly.";
// } else {
//Your code here to handle a successful verification
ini_set("SMTP", "smtp.mail.yahoo.com");
$body = "
Name: ".$name."
Email: ".$email."
Subject: ".$subject."
Message: ".$message."
\r\n";
mail("davy_yg@yahoo.com", "Message from Indonusa Website", $body, "From: ".$email);
echo "Your message has been sent, we will get back to your shortly.";
$name = trim("");
$email = trim("");
$subject = trim("");
$message = trim("");
}
}
else {
echo "Please fill in <b>all</b> the fields!";
}
?>
<div id="carticle3">
<div id="inputID">
<form name="contact" action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">
<div id="title">Your Message: </div><br><br>
<input type="text" name="name" placeholder="Your name" value=""><br>
<input type="text" name="email" placeholder="Your email" value=""><br>
<input type="text" name="subject" placeholder="subject" value=""><br>
<textarea rows="4" cols="20" placeholder="Message"></textarea><br><br>
<input type="submit" name="submit" value="kirim" class="button">
</form>
</div>
</div>
Do I need to install mail server or something on the web server so that this website can send email to the intended address?