-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathmail.php
58 lines (51 loc) · 1.24 KB
/
mail.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
<?php
include "core/init.php";
protect_page();
admin_protect();
include "includes/overall/header.php";
?>
<h1>Email all users</h1>
<?php
if (isset($_GET['success']) === true && empty($_GET['success']) === true) {
?>
<p>Email has been sent</p>
<?php
} else {
if (empty($_POST) === false) {
// echo 'a';
if (empty($_POST['subject']) === true) {
$errors[] = 'Subject is required';
}
if (empty($_POST['body']) === true) {
$errors[] = 'Body is required';
}
if (empty($errors) === false) {
echo output_errors($errors);
} else {
// send email
// echo 'send';
mail_users($_POST['subject'], $_POST['body']);
header('Location: mail.php?success');
exit();
}
}
?>
<form action="" method="post">
<ul>
<li>
Subject*:<br>
<input type="text" name="subject">
</li>
<li>
Body*:<br>
<textarea name="body"></textarea>
</li>
<li>
<input type="submit" value="Send">
</li>
</ul>
</form>
<?php
}
include "includes/overall/footer.php";
?>