Read 383 times | Created 2013-02-01 07:04:28 | Updated 2013-02-01 07:04:28 | | |

 

<?php
if(isset($_POST['kirim'])){
  ini_set("SMTP","ssl://smtp.gmail.com");
  ini_set("smtp_port","465");
  $to='kimichi07@gmail.com';
  $subject='judul kirim email';
  $message=$_POST['pesan'];
  $header='Form: '.$_POST['email'];
  $status=mail($to,$subject,$message,$header);
  header("Location:".$_SERVER['PHP_SELF']."?msg=".($status?"email berhasil dikirim":"email gagal dikirim"));
}
?>
<!DOCTYPE html>
<html>
  <head>
    <title>kirim email</title>
  </head>
  <body>
    <?php echo isset($_GET['msg'])?"<h2>".$_GET['msg']."</h2>":'';?>
    <form action="" method="post">
      <table>
        <tr>
          <td>Your Email</td>
          <td><input type="text" name="email" /></td>
        </tr>
        <tr>
          <td>Your Massage</td>
          <td><textarea name="pesan"></textarea></td>
        </tr>
        <tr>
          <td colspan="2">
            <input type="submit" name="kirim" value="Send Massage"/>
          </td>
        </tr>
        </table>
    </form>
  </body>
</html>