-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendmail.php
More file actions
67 lines (60 loc) · 2.1 KB
/
sendmail.php
File metadata and controls
67 lines (60 loc) · 2.1 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
</head>
<body>
<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
$link = mysqli_connect("localhost", "root", "", "tap");
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
$sql = "SELECT email FROM applicants WHERE selected = 'yes'";
$result = $link->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$to = $row["email"];
$subject = "event";
$message = "You have been selected as our partner further details will be sent soon.";
$retval = mail($row["email"],"Congratulations!",$message);
// if( $retval == true ) {
// echo "Message sent successfully...";
// }else {
// echo "Message could not be sent...";
// }
}
} else {
echo "0 results";
}
$sql = "SELECT email FROM applicants WHERE selected = 'no'";
$result = $link->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$to = $row["email"];
$subject = "event";
$message = "You have not been selected as our partner .";
$retval = mail($row["email"],"Sorry!",$message);
// if( $retval == true ) {
// echo "Message sent successfully...";
// }else {
// echo "Message could not be sent...";
// }
}header("Location: index.html");
} else {
echo "0 results";
}
header("index.html");
// Close connection
mysqli_close($link);
?>
</body>
</html>