SHARE
TWEET

index.php

lordRaze May 22nd, 2017 26 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.     $username = isset($_POST['dari']) ? $_POST['dari'] : ""; //untuk auth email pengirim / username email
  4.     $password = isset($_POST['password']) ? $_POST['password'] : ""; //password email
  5.     $nama_pengirim = isset($_POST['nama_pengirim']) ? $_POST['nama_pengirim'] : "";
  6.     $kepada = isset($_POST['kepada']) ? $_POST['kepada'] : "";
  7.     $nama_penerima = isset($_POST['nama_penerima']) ? $_POST['nama_penerima'] : "";
  8.     $subjek = isset($_POST['subjek']) ? $_POST['subjek'] : "";
  9.     $pesan = isset($_POST['pesan']) ? $_POST['pesan'] : "";
  10.  
  11.     if(isset($_POST["submit"])){
  12.         include('send_email.php');
  13.  
  14.         $send_mail = send_mail($kepada, $nama_penerima, $subjek, $pesan, $username, $password, $nama_pengirim);
  15.        
  16.         if($send_mail['cek']){ //jika sukses
  17.             echo "Pesan Berhasil Dikirim";
  18.         }
  19.         else{
  20.             echo $send_mail['error'];
  21.         }
  22.     }
  23.        
  24. ?>
  25. <!DOCTYPE html>
  26. <html>
  27.     <head>
  28.         <meta charset="utf-8">
  29.         <meta name="viewport" content="width=device-width, initial-scale=1">
  30.         <!-- Bootstrap -->
  31.         <link rel="stylesheet" type="text/css" href="http://localhost/belajar/php/Email/assets/Bootstrap-3.3.7/css/bootstrap.min.css">
  32.         <title>Latihan Kirim Email Dengan Form</title>
  33.         <style type="text/css">
  34.             body{
  35.                 padding-top: 100px;
  36.             }
  37.         </style>
  38.     </head>
  39.     <body>
  40.         <div class="container">
  41.             <!-- <h4>
  42.                 Pastikan Setting Less Sequre Apps akun google anda aktif. <a href="https://www.google.com/settings/security/lesssecureapps" target="_blank">Klik Disini Untuk Mengaktifkan.</a>
  43.             </h4> -->
  44.             <h3 class="text-center">
  45.                 Latihan Kirim Email Dengan Form
  46.             </h3>
  47.             <!-- Form Kirim Email -->
  48.             <form method="POST" enctype="multipart/form-data" action="">
  49.                 <div class="form-group">
  50.                     <div class="row">
  51.                         <!-- Pengirim - email-->
  52.                         <div class="col-xs-6">
  53.                             <label for="dari">Dari</label>
  54.                             <input class="form-control" type="email" name="dari" id="dari" required="required" placeholder="your_email@gmail.com">
  55.                         </div>
  56.                         <!-- nama pengirim -->
  57.                         <div class="col-xs-6">
  58.                             <label for="nama_pengirim">Nama Pengirim</label>
  59.                             <input class="form-control" type="text" name="nama_pengirim" id="nama_pengirim" placeholder="Namamu">
  60.                         </div>
  61.                     </div>
  62.                 </div>
  63.                 <div class="form-group">
  64.                     <label for="password">Password Emailmu</label>
  65.                     <input class="form-control" type="password" name="password" id="password" required="required" placeholder="Password Emailmu">
  66.                 </div>
  67.                 <div class="form-group">
  68.                     <div class="row">
  69.                         <!-- penerima - email-->
  70.                         <div class="col-xs-6">
  71.                             <label for="kepada">Kepada</label>
  72.                             <input class="form-control" type="email" name="kepada" id="kepada" required="required" placeholder="email_dia@gmail.com">
  73.                         </div>
  74.                         <!-- nama penerima -->
  75.                         <div class="col-xs-6">
  76.                             <label for="nama_pengirim">Nama Penerima</label>
  77.                             <input class="form-control" type="text" name="nama_penerima" id="nama_penerima" placeholder="Nama Dia">
  78.                         </div>
  79.                     </div>
  80.                 </div>
  81.  
  82.                 <!-- Subjek -->
  83.                 <div class="form-group">
  84.                     <label for="subjek">Subjek</label>
  85.                     <input class="form-control" type="text" name="subjek" id="subjek" required="required" placeholder="Subjek Pesan">
  86.                 </div>
  87.                
  88.                 <!-- Isi Pesan -->
  89.                 <div class="form-group">
  90.                     <label for="pesan">Pesan</label>
  91.                     <textarea class="form-control" name="pesan" id="pesan" rows="8" placeholder="Isi Pesan"></textarea>
  92.                 </div>
  93.  
  94.                 <!-- Button Submit -->
  95.                 <div class="form-group">
  96.                     <div class="text-right">
  97.                         <button class="btn btn-primary" type="submit" name="submit">Kirim</button>
  98.                         <button class="btn btn-default" type="reset">Reset</button>
  99.                     </div>
  100.                 </div>
  101.             </form>
  102.         </div>
  103.         <!-- jquery -->
  104.         <script type="text/javascript" src="http://localhost/belajar/php/Email/assets/jQuery-2.2.4/jquery-2.2.4.min.js"></script>
  105.         <!-- js bootsrap -->
  106.         <script type="text/javascript" src="http://localhost/belajar/php/Email/assets/Bootstrap-3.3.7/js/bootstrap.min.js"></script>       
  107.     </body>
  108. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top