contact_us.php
<h2>Contact Us</h2>
<br /><br />
<form action="send_email.php" method="POST">
<table border="0" cellpadding="2">
<tr>
<td>Nama Lengkap: </td>
<td><input name="nama" type="text" value="" size="30" /></td>
</tr>
<tr>
<td>E-mail: </td>
<td><input name="email" type="text" value="" size="20" /></td>
</tr>
<tr>
<td>Nomor Telepon: </td>
<td><input name="telp" type="text" value="" size="15" /></td>
</tr>
<tr>
<td>Pilih Subjek : </td>
<td><select name="subjek"><option value=Additive selected>Additive</option>
<option value=Air Freshener>Air Freshener</option>
<option value=Lainnya>Lainnya</option>
</td>
</tr>
<tr>
<td>Pesan Anda : </td>
<td><textarea name="comments" cols=30 rows=6></textarea></td>
</tr>
<tr>
<td></td>
<td><input name="kirim_pesan" type="submit" value="Kirim Pesan" />
</table>
</form>
</div>
send_mail.php
<?php
//
$nama = isset($_GET['nama']) ? $_GET['nama'] : '';
$email = isset($_GET['email']) ? $_GET['email'] : '';
$telepon = isset($_GET['telepon']) ? $_GET['telepon'] : '';
$subjek = isset($_GET['subjek']) ? $_GET['subjek'] : '';
$comments = isset($_GET['comments']) ? $_GET['comments'] : '';
//$nama = $_GET["nama"];
//$email = $_GET["email"];
//$telepon = $_GET["telepon"];
//$subjek = $_GET["subjek"];
//$comments = $_GET["comments"];
?>
<?php
// using htmlentities
$newnama= htmlspecialchars($nama, ENT_QUOTES);
$newemail = htmlspecialchars($email, ENT_QUOTES);
$telepon = htmlspecialchars($telepon, ENT_QUOTES);
$newsubjek = htmlspecialchars($subjek, ENT_QUOTES);
$newcomments = htmlspecialchars($comments, ENT_QUOTES);
?>
<h1>Demo Send Email</h1>
<hr>
Kepada : Kamu
Subject : <?php echo $subjek; ?>
Pesan : <?php echo $comments; ?>
Dari : <?php echo $nama; ?>
<br />
<?php
ini_set("SMTP", "172.16.1.1");
ini_set("sendmail_from", "$email");
mail("david_yg20@yahoo.com", "$subjek", "$comments");
?>
Telah dilakukan!
Demo Send Email
--------------------------------------------------------------------------------
Kepada : Kamu Subject : Pesan : Dari :
Warning: mail() [function.mail]: Failed to connect to mailserver at "172.16.1.1" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\Masterlink\cgoods\send_email.php on line 47
Telah dilakukan!
The above error appears after I press "Kirim Pesan".
Also, I do not receive the e-mail I suppose to receive, also the Subject, Pesan, and Dari are empty.