0

This is my codes in my localhost:

contactus.php

<html>
<head>

<link href= "css/contact.css" rel="stylesheet" type="text/css" media="screen"> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

<script>

$("#inputID").ready(function(){
  $("#inputID input").focus(function(){
    $(this).css("background-color","#fbecc5");
  });
  $("#inputID input").blur(function(){
    $(this).css("background-color","#f5f5f5");
  });

   $("#inputID textarea").focus(function(){
    $(this).css("background-color","#fbecc5");
  });
  $("#inputID textarea").blur(function(){
    $(this).css("background-color","#f5f5f5");
  });
});


</script>
</head>

<?php include('includes/navigation.php'); ?>


<body>

<div id="titlebar"><div id="title"><h2 class="title">Contact Us</h2></title></div>

<div id="stitle">
Contact Us
</div>

<div id="smalltitlebar"><div id="title">Contact Us</div></div>

<div id="googlemap">
<iframe width="700" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps/ms?msa=0&amp;msid=212050600248541473831.0004de8d18ea9e610fb35&amp;ie=UTF8&amp;ll=-6.20908,106.77029&amp;spn=0,0&amp;t=m&amp;iwloc=0004e60268a255fbe1c79&amp;output=embed"></iframe><br />
</div>


<?php /*
<div id="map"><img src="images/map.jpg"></div> */ ?>

<div id="carticle1">

<div id="title">Ask us anything </div><br>

Please dont hesitate to contact us regarding 
any question about our services<br><br>

We also have extensive amount of frequently 
asked question (FAQ) that you can access from
 our support page<br><br>

Any email requiring support will be answered
 not longer than 24 hours<br><br>

</div>

<?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", "plus.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" accept-charset="iso-8859-1">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>


<div id="carticle2">

<div id="title">PT Indonusa System Integrator Prima</div><br>

    Plaza Kelapa Dua .. 6th Floor
    Jl. Panjang Arteri Kelapa Dua no.29<br>
    Jakarta Barat .. 11550<br>
    Phone : +6221-390 8911 ( Customer Support )<br>
    Phone : +6221-9127 7229 ( NOC )<br>
    Fax : +6221-392 8332 ( Finance )<br>
    Email : cs@indonusa.net.id
</div>

<br><br><br>

</body>

<?php include('includes/footer.php'); ?>

<br>

</html>

My mail server: uses smtp.indonusa.net.id

I already set my apache php.ini to:

[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
; SMTP = smtp.indonusa.net.id
; smtp_port = 25

And I still do not receive any email that I fill in from the contact form.

2
Contributors
2
Replies
18
Views
3 Years
Discussion Span
Last Post by davy_yg
0

Hello,

I revise my code as follows:

contactus2.php

<?php

    $from_name = strip_tags(@$_POST['name']);
    $from_email = str_replace(" ", "", strip_tags(@$_POST['email']));
    $subject = str_replace(" ", "", strip_tags(@$_POST['subject']));
    $message = strip_tags(@$_POST['message']);

    send_email($to_name = null, $to_email = 'davy_yg@yahoo.com', $from_name, $from_email, $subject, $message, $type = 'text', $cc = null, $bcc = null);

    function send_email($to_name, $to_email, $from_name = null, $from_email = null, $subject, $message, $type = 'text', $cc = null, $bcc = null) {
    if (!$to_name || !$to_email || !$from_name || !$from_email) return false;
    $header = "";
    switch($type) {
    case 'html':
    $header .= "MIME-Version: 1.0\r\n";
    $header .= "Content-type: text/html; charset=iso-8859-1\r\n";
    break;
    case 'text':
    default:
    $message = wordwrap($message, 70, "\r\n");
    break;
    }
    $header .= "To: $to_name <$to_email>\r\n";
    $header .= "From: $from_name <$from_email>\r\n";
    if ($cc) {
    $header .= "Cc: $cc\r\n";
    }
    if ($bcc) {
    $header .= "Bcc: $bcc\r\n";
    }
    $header .= "Date: ".date(r)."\r\n";
    $header .= "Reply-To: $from_name <$from_email>\r\n";
    $header .= "X-Mailer: PHP/".phpversion();
    return @mail($to_name . '<' . $to_email . '>', $subject, $message, $header);
    }



?>


<div id="carticle3">

<div id="inputID">

<form name="contact" action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">
<div id="title" accept-charset="iso-8859-1">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>


<div id="carticle2">

<div id="title">PT Indonusa System Integrator Prima</div><br>

    Plaza Kelapa Dua .. 6th Floor
    Jl. Panjang Arteri Kelapa Dua no.29<br>
    Jakarta Barat .. 11550<br>
    Phone : +6221-390 8911 ( Customer Support )<br>
    Phone : +6221-9127 7229 ( NOC )<br>
    Fax : +6221-392 8332 ( Finance )<br>
    Email : cs@indonusa.net.id
</div>

<br><br><br>

</body>

<?php include('includes/footer.php'); ?>

<br>

</html>

After I fill in the form, click send and checking my email. I still do not receive the email that I intended.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.