-
Notifications
You must be signed in to change notification settings - Fork 32
/
kirim_form.php
45 lines (38 loc) · 1.31 KB
/
kirim_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
if(isset($_POST['contactFrmSubmit']) && !empty($_POST['nama']) && !empty($_POST['email']) && (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) && !empty($_POST['pesan'])){
// data form yang dikirimkan
$nama = $_POST['nama'];
$email = $_POST['email'];
$pesan= $_POST['pesan'];
/*
* Kirim email ke alamat dibawah ini
*/
$ke = '[email protected]';
$subjek= 'Kontak Bantuan Aplikasi Chirex 1.0';
$kontenHtml = '
<h4>permintaan kontak telah disampaikan pada Admin, berikut ini rinciannya.</h4>
<table cellspacing="0" style="width: 300px; height: 200px;">
<tr>
<th>Nama:</th><td>'.$nama.'</td>
</tr>
<tr style="background-color: #e0e0e0;">
<th>Email:</th><td>'.$email.'</td>
</tr>
<tr>
<th>Pesan:</th><td>'.$pesan.'</td>
</tr>
</table>';
// Mengatur header content-type untuk mengirim email HTML
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// header tambahan
$headers .= 'From: '.$nama.'<'.$email.'>' . "\r\n";
// Kirim email
if(mail($ke,$subjek,$kontenHtml,$headers)){
$status = 'ok';
}else{
$status = 'err';
}
// status output
echo $status;die;
}