-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
108 lines (102 loc) · 4.91 KB
/
index.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/* Load PHP Mailer */
include('PHPMailer/src/SMTP.php');
include('PHPMailer/src/PHPMailer.php');
require('PHPMailer/src/Exception.php');
if (isset($_POST['SendMail'])) {
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->setFrom($_POST['from']);
$mail->addAddress($_POST['to']);
$mail->Subject = $_POST['subject'];
$mail->Body = $_POST['message'];
$mail->isHTML(true);
//$mail->AltBody = "This message is generated by plain text !";
$mail->IsSMTP();
$mail->SMTPSecure = 'ssl';
$mail->Host = 'your_mail_server_host';
$mail->SMTPAuth = true;
$mail->Port = 465;
$mail->Username = 'your_mail_username';
$mail->Password = 'your_password';
if (!$mail->send()) {
$err = "Mail Not Send, $mail->ErrorInfo";
} else {
$success = "Mail Send";
}
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<!-- include summernote css/js -->
<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote.min.css" rel="stylesheet">
<title>Simple Ezana Mailer</title>
</head>
<body>
<div class="container">
<br>
<div class="card">
<div class="card-hea text-center">
<h5>Ezana Mailer</h5>
</div>
<!-- Alerts -->
<?php if (isset($success)) { ?>
<!--This code for injecting success alert-->
<div class="alert alert-success alert-dismissible fade show text-center" role="alert">
<strong>Success! </strong> <br> <?php echo $success; ?>
<button class="close" type="button" data-dismiss="alert" aria-label="Close"><span class="font-weight-light" aria-hidden="true">×</span></button>
</div>
<?php }
if (isset($err)) { ?>
<!--This code for injecting error alert-->
<div class="alert alert-danger alert-dismissible fade show text-center" role="alert">
<strong>Error! </strong> <br> <?php echo $err; ?>
<button class="close" type="button" data-dismiss="alert" aria-label="Close"><span class="font-weight-light" aria-hidden="true">×</span></button>
</div>
<?php } ?>
<div class="card-body">
<form method="POST">
<div class="row">
<div class="form-group col-md-6">
<label for="exampleInputEmail1">From:</label>
<input type="email" name="from" required class="form-control">
</div>
<div class="form-group col-md-6">
<label for="exampleInputEmail1">To:</label>
<input type="email" name="to" required class="form-control">
</div>
<div class="form-group col-md-12">
<label for="exampleInputEmail1">Subject</label>
<input type="text" name="subject" required class="form-control">
</div>
<div class="form-group col-md-12">
<label for="exampleInputEmail1">Message</label>
<textarea type="text" name="message" required class="form-control" id="Summernote"></textarea>
</div>
</div>
<button type="submit" name="SendMail" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS, the summer note js -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote.min.js"></script>
<!-- Initialize Summernote Js -->
<script>
$('#summernote').summernote({
placeholder: 'Type Your Mail',
tabsize: 2,
height: 100
});
</script>
</body>
</html>