Advertisement
cdsatrian

sendemail

Feb 4th, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.22 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['kirim'])){
  3.   $to="kimichi07@gmail.com@gmail.com";
  4.   $subject='judul kirim email';
  5.   $message=$_POST['pesan'];
  6.   $header='Form: '.$_POST['email'];
  7.   $headers   = array();
  8.   $headers[] = "MIME-Version: 1.0";
  9.   $headers[] = "Content-type: text/plain; charset=iso-8859-1";
  10.   $headers[] = "From: ".$_POST['email'];
  11.   $headers[] = "Subject: {$subject}";
  12.   $headers[] = "X-Mailer: PHP/".phpversion();
  13.   $status=mail($to, $subject, $message, implode("\r\n", $headers));
  14.   header("Location:".$_SERVER['PHP_SELF']."?msg=".($status?"email berhasil dikirim":"email gagal dikirim"));
  15. }
  16. ?>
  17. <!DOCTYPE html>
  18. <html>
  19.   <head>
  20.     <title>kirim email</title>
  21.   </head>
  22.   <body>
  23.     <?php echo isset($_GET['msg'])?"<h2>".$_GET['msg']."</h2>":'';?>
  24.     <form action="" method="post">
  25.       <table>
  26.         <tr>
  27.           <td>Your Email</td>
  28.           <td><input type="text" name="email" /></td>
  29.         </tr>
  30.         <tr>
  31.           <td>Your Massage</td>
  32.           <td><textarea name="pesan"></textarea></td>
  33.         </tr>
  34.         <tr>
  35.           <td colspan="2">
  36.             <input type="submit" name="kirim" value="Send Massage"/>
  37.           </td>
  38.         </tr>
  39.         </table>
  40.     </form>
  41.   </body>
  42. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement